Mercurial > dwindows
annotate ios/dw.m @ 2817:5000a8a43825
iOS: Fix some memory leaks and remove unnecessary code.
Like on Mac we need to release the item being packed in dw_box_pack_*().
However we don't need the retains or autoreleases since we use ARC on iOS.
The UIWindow release is not necessary, garbage collection will remove it.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 02 Aug 2022 03:07:52 +0000 |
parents | 9c9b680f7772 |
children | d5d09bdd61d6 |
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 * |
2751
ee1cfa7d645e
Update copyright dates for the new year 2022.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2740
diff
changeset
|
5 * (C) 2011-2022 Brian Smith <brian@dbsoft.org> |
ee1cfa7d645e
Update copyright dates for the new year 2022.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2740
diff
changeset
|
6 * (C) 2011-2021 Mark Hessling <mark@rexx.org> |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
7 * (C) 2017 Ralph Shane (Base tree view implementation) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8 * |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
9 * Requires 13.0 or later. |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10 * 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
|
11 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
12 #import <Foundation/Foundation.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
13 #import <UIKit/UIKit.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
14 #import <WebKit/WebKit.h> |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
15 #import <AudioToolbox/AudioToolbox.h> |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
16 #import <UserNotifications/UserNotifications.h> |
2712
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
17 #import <UniformTypeIdentifiers/UTDefines.h> |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
18 #import <UniformTypeIdentifiers/UTType.h> |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
19 #import <UniformTypeIdentifiers/UTCoreTypes.h> |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
20 #include "dw.h" |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
21 #include <sys/utsname.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
22 #include <sys/socket.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
23 #include <sys/un.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
24 #include <sys/mman.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
25 #include <sys/time.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
26 #include <sys/stat.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
27 #include <math.h> |
2698
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
28 #include <spawn.h> |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
29 |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
30 /* 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
|
31 #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
|
32 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
|
33 localpool = [[NSAutoreleasePool alloc] init]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
34 #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
|
35 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
36 /* 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
|
37 #define DW_FUNCTION_INIT |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
38 #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
|
39 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
|
40 DW_LOCAL_POOL_IN; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
41 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
|
42 [_args addPointer:(void *)_##func]; |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
43 #define DW_FUNCTION_ADD_PARAM1(param1) [_args addPointer:(void *)¶m1]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
44 [_args addPointer:(void *)pthread_getspecific(_dw_fg_color_key)]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
45 [_args addPointer:(void *)pthread_getspecific(_dw_bg_color_key)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
46 #define DW_FUNCTION_ADD_PARAM2(param1, param2) [_args addPointer:(void *)¶m1]; \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
47 [_args addPointer:(void *)¶m2]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
48 [_args addPointer:(void *)pthread_getspecific(_dw_fg_color_key)]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
49 [_args addPointer:(void *)pthread_getspecific(_dw_bg_color_key)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
50 #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
|
51 [_args addPointer:(void *)¶m2]; \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
52 [_args addPointer:(void *)¶m3]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
53 [_args addPointer:(void *)pthread_getspecific(_dw_fg_color_key)]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
54 [_args addPointer:(void *)pthread_getspecific(_dw_bg_color_key)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
55 #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
|
56 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
57 [_args addPointer:(void *)¶m3]; \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
58 [_args addPointer:(void *)¶m4]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
59 [_args addPointer:(void *)pthread_getspecific(_dw_fg_color_key)]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
60 [_args addPointer:(void *)pthread_getspecific(_dw_bg_color_key)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
61 #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
|
62 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
63 [_args addPointer:(void *)¶m3]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
64 [_args addPointer:(void *)¶m4]; \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
65 [_args addPointer:(void *)¶m5]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
66 [_args addPointer:(void *)pthread_getspecific(_dw_fg_color_key)]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
67 [_args addPointer:(void *)pthread_getspecific(_dw_bg_color_key)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
68 #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
|
69 [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
70 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
71 [_args addPointer:(void *)¶m3]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
72 [_args addPointer:(void *)¶m4]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
73 [_args addPointer:(void *)¶m5]; \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
74 [_args addPointer:(void *)¶m6]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
75 [_args addPointer:(void *)pthread_getspecific(_dw_fg_color_key)]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
76 [_args addPointer:(void *)pthread_getspecific(_dw_bg_color_key)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
77 #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
|
78 [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
79 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
80 [_args addPointer:(void *)¶m3]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
81 [_args addPointer:(void *)¶m4]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
82 [_args addPointer:(void *)¶m5]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
83 [_args addPointer:(void *)¶m6]; \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
84 [_args addPointer:(void *)¶m7]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
85 [_args addPointer:(void *)pthread_getspecific(_dw_fg_color_key)]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
86 [_args addPointer:(void *)pthread_getspecific(_dw_bg_color_key)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
87 #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
|
88 [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
89 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
90 [_args addPointer:(void *)¶m3]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
91 [_args addPointer:(void *)¶m4]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
92 [_args addPointer:(void *)¶m5]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
93 [_args addPointer:(void *)¶m6]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
94 [_args addPointer:(void *)¶m7]; \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
95 [_args addPointer:(void *)¶m8]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
96 [_args addPointer:(void *)pthread_getspecific(_dw_fg_color_key)]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
97 [_args addPointer:(void *)pthread_getspecific(_dw_bg_color_key)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
98 #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
|
99 [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
100 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
101 [_args addPointer:(void *)¶m3]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
102 [_args addPointer:(void *)¶m4]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
103 [_args addPointer:(void *)¶m5]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
104 [_args addPointer:(void *)¶m6]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
105 [_args addPointer:(void *)¶m7]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
106 [_args addPointer:(void *)¶m8]; \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
107 [_args addPointer:(void *)¶m9]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
108 [_args addPointer:(void *)pthread_getspecific(_dw_fg_color_key)]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
109 [_args addPointer:(void *)pthread_getspecific(_dw_bg_color_key)]; |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
110 #define DW_FUNCTION_RESTORE_PARAM1(param1, vartype1) \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
111 vartype1 param1 = *((vartype1 *)[_args pointerAtIndex:1]); \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
112 UIColor *__attribute__((__unused__))_dw_fg_color = (UIColor *)[_args pointerAtIndex:2]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
113 UIColor *__attribute__((__unused__))_dw_bg_color = (UIColor *)[_args pointerAtIndex:3]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
114 #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
|
115 vartype1 param1 = *((vartype1 *)[_args pointerAtIndex:1]); \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
116 vartype2 param2 = *((vartype2 *)[_args pointerAtIndex:2]); \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
117 UIColor *__attribute__((__unused__))_dw_fg_color = (UIColor *)[_args pointerAtIndex:3]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
118 UIColor *__attribute__((__unused__))_dw_bg_color = (UIColor *)[_args pointerAtIndex:4]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
119 #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
|
120 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
|
121 vartype2 param2 = *((vartype2 *)[_args pointerAtIndex:2]); \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
122 vartype3 param3 = *((vartype3 *)[_args pointerAtIndex:3]); \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
123 UIColor *__attribute__((__unused__))_dw_fg_color = (UIColor *)[_args pointerAtIndex:4]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
124 UIColor *__attribute__((__unused__))_dw_bg_color = (UIColor *)[_args pointerAtIndex:5]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
125 #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
|
126 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
|
127 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
|
128 vartype3 param3 = *((vartype3 *)[_args pointerAtIndex:3]); \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
129 vartype4 param4 = *((vartype4 *)[_args pointerAtIndex:4]); \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
130 UIColor *__attribute__((__unused__))_dw_fg_color = (UIColor *)[_args pointerAtIndex:5]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
131 UIColor *__attribute__((__unused__))_dw_bg_color = (UIColor *)[_args pointerAtIndex:6]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
132 #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
|
133 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
|
134 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
|
135 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
|
136 vartype4 param4 = *((vartype4 *)[_args pointerAtIndex:4]); \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
137 vartype5 param5 = *((vartype5 *)[_args pointerAtIndex:5]); \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
138 UIColor *__attribute__((__unused__))_dw_fg_color = (UIColor *)[_args pointerAtIndex:6]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
139 UIColor *__attribute__((__unused__))_dw_bg_color = (UIColor *)[_args pointerAtIndex:7]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
140 #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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 vartype5 param5 = *((vartype5 *)[_args pointerAtIndex:5]); \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
146 vartype6 param6 = *((vartype6 *)[_args pointerAtIndex:6]); \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
147 UIColor *__attribute__((__unused__))_dw_fg_color = (UIColor *)[_args pointerAtIndex:7]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
148 UIColor *__attribute__((__unused__))_dw_bg_color = (UIColor *)[_args pointerAtIndex:8]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
149 #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
|
150 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
|
151 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
|
152 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
|
153 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
|
154 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
|
155 vartype6 param6 = *((vartype6 *)[_args pointerAtIndex:6]); \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
156 vartype7 param7 = *((vartype7 *)[_args pointerAtIndex:7]); \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
157 UIColor *__attribute__((__unused__))_dw_fg_color = (UIColor *)[_args pointerAtIndex:8]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
158 UIColor *__attribute__((__unused__))_dw_bg_color = (UIColor *)[_args pointerAtIndex:9]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
159 #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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 vartype7 param7 = *((vartype7 *)[_args pointerAtIndex:7]); \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
167 vartype8 param8 = *((vartype8 *)[_args pointerAtIndex:8]); \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
168 UIColor *__attribute__((__unused__))_dw_fg_color = (UIColor *)[_args pointerAtIndex:9]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
169 UIColor *__attribute__((__unused__))_dw_bg_color = (UIColor *)[_args pointerAtIndex:10]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
170 #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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 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
|
178 vartype8 param8 = *((vartype8 *)[_args pointerAtIndex:8]); \ |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
179 vartype9 param9 = *((vartype9 *)[_args pointerAtIndex:9]); \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
180 UIColor *__attribute__((__unused__))_dw_fg_color = (UIColor *)[_args pointerAtIndex:10]; \ |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
181 UIColor *__attribute__((__unused__))_dw_bg_color = (UIColor *)[_args pointerAtIndex:11]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
182 #define DW_FUNCTION_END } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
183 #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
|
184 [_args release]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
185 DW_LOCAL_POOL_OUT; } \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
186 void _##func(NSPointerArray *_args) { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
187 #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
|
188 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
|
189 rettype myreturn = *((rettype *)tmp); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
190 free(tmp); \ |
2813
9c9b680f7772
Mac/iOS: Fix a memory leak when calling API functions that return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2807
diff
changeset
|
191 [_args release]; \ |
9c9b680f7772
Mac/iOS: Fix a memory leak when calling API functions that return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2807
diff
changeset
|
192 DW_LOCAL_POOL_OUT; \ |
9c9b680f7772
Mac/iOS: Fix a memory leak when calling API functions that return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2807
diff
changeset
|
193 return myreturn; }} \ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
194 void _##func(NSPointerArray *_args) { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
195 #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
|
196 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
|
197 [_args addPointer:_myreturn]; }} |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
198 #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
|
199 |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
200 unsigned long _dw_colors[] = |
2372
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 0x00000000, /* 0 black */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
203 0x000000bb, /* 1 red */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
204 0x0000bb00, /* 2 green */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
205 0x0000aaaa, /* 3 yellow */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
206 0x00cc0000, /* 4 blue */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
207 0x00bb00bb, /* 5 magenta */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
208 0x00bbbb00, /* 6 cyan */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
209 0x00bbbbbb, /* 7 white */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
210 0x00777777, /* 8 grey */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
211 0x000000ff, /* 9 bright red */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
212 0x0000ff00, /* 10 bright green */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
213 0x0000eeee, /* 11 bright yellow */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
214 0x00ff0000, /* 12 bright blue */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
215 0x00ff00ff, /* 13 bright magenta */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
216 0x00eeee00, /* 14 bright cyan */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
217 0x00ffffff, /* 15 bright white */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
218 0xff000000 /* 16 default color */ |
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 |
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 * 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
|
223 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
224 #define NUM_EXTS 8 |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
225 char *_dw_image_exts[NUM_EXTS+1] = |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
226 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
227 ".png", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
228 ".ico", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
229 ".icns", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
230 ".gif", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
231 ".jpg", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
232 ".jpeg", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
233 ".tiff", |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
234 ".bmp", |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
235 NULL |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
236 }; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
237 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
238 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
|
239 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
240 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
|
241 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
|
242 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
243 /* Try various extentions */ |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
244 for(i = 0; i < NUM_EXTS; i++) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
245 { |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
246 strcpy(file, filename); |
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
247 strcat(file, _dw_image_exts[i]); |
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
248 if(access(file, R_OK ) == 0) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
249 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
250 found_ext = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
251 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
252 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
253 } |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
254 if(found_ext == 1) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
255 { |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
256 return _dw_image_exts[i]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
257 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
258 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
259 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
260 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
261 /* Return the RGB color regardless if a predefined color was passed */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
262 unsigned long _dw_get_color(unsigned long thiscolor) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
263 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
264 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
|
265 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
266 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
|
267 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
268 else if(thiscolor < 17) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
269 { |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
270 return _dw_colors[thiscolor]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
271 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
272 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
273 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
274 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
275 /* Thread specific storage */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
276 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
|
277 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
|
278 pthread_key_t _dw_bg_color_key; |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
279 static int DWOSMajor, DWOSMinor, DWOSBuild; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
280 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
|
281 static char _dw_app_id[_DW_APP_ID_SIZE+1]= {0}; |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
282 static int _dw_dark_mode_state = DW_FEATURE_UNSUPPORTED; |
2606
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
283 static CGPoint _dw_event_point = {0}; |
2638
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
284 static NSMutableArray *_dw_toplevel_windows; |
2372
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 /* Create a default colors for a thread */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
287 void _dw_init_colors(void) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
288 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
289 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
|
290 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
|
291 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
|
292 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
293 |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
294 typedef struct _dwsighandler |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
295 { |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
296 struct _dwsighandler *next; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
297 ULONG message; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
298 HWND window; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
299 int id; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
300 void *signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
301 void *discfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
302 void *data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
303 |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
304 } DWSignalHandler; |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
305 |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
306 static DWSignalHandler *DWRoot = NULL; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
307 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
308 /* Some internal prototypes */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
309 static void _dw_do_resize(Box *thisbox, int x, int y); |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
310 void _dw_handle_resize_events(Box *thisbox); |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
311 int _dw_remove_userdata(UserData **root, const char *varname, int all); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
312 int _dw_main_iteration(NSDate *date); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
313 CGContextRef _dw_draw_context(id image, bool antialias); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
314 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
|
315 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
316 /* 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
|
317 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
|
318 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
319 static id lastwindow = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
320 id redraw = lastwindow; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
321 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
322 if(skip && window == nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
323 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
324 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
325 lastwindow = window; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
326 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
|
327 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
328 dw_window_redraw(redraw); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
329 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
330 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
331 |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
332 DWSignalHandler *_dw_get_handler(HWND window, int messageid) |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
333 { |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
334 DWSignalHandler *tmp = DWRoot; |
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 /* 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
|
337 while(tmp) |
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(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
|
340 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
341 return tmp; |
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 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
344 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
345 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
346 } |
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 typedef struct |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
349 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
350 ULONG message; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
351 char name[30]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
352 |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
353 } DWSignalList; |
2372
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 /* List of signals */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
356 #define SIGNALMAX 19 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
357 |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
358 static DWSignalList DWSignalTranslate[SIGNALMAX] = { |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
359 { _DW_EVENT_CONFIGURE, DW_SIGNAL_CONFIGURE }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
360 { _DW_EVENT_KEY_PRESS, DW_SIGNAL_KEY_PRESS }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
361 { _DW_EVENT_BUTTON_PRESS, DW_SIGNAL_BUTTON_PRESS }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
362 { _DW_EVENT_BUTTON_RELEASE, DW_SIGNAL_BUTTON_RELEASE }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
363 { _DW_EVENT_MOTION_NOTIFY, DW_SIGNAL_MOTION_NOTIFY }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
364 { _DW_EVENT_DELETE, DW_SIGNAL_DELETE }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
365 { _DW_EVENT_EXPOSE, DW_SIGNAL_EXPOSE }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
366 { _DW_EVENT_CLICKED, DW_SIGNAL_CLICKED }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
367 { _DW_EVENT_ITEM_ENTER, DW_SIGNAL_ITEM_ENTER }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
368 { _DW_EVENT_ITEM_CONTEXT, DW_SIGNAL_ITEM_CONTEXT }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
369 { _DW_EVENT_LIST_SELECT, DW_SIGNAL_LIST_SELECT }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
370 { _DW_EVENT_ITEM_SELECT, DW_SIGNAL_ITEM_SELECT }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
371 { _DW_EVENT_SET_FOCUS, DW_SIGNAL_SET_FOCUS }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
372 { _DW_EVENT_VALUE_CHANGED, DW_SIGNAL_VALUE_CHANGED }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
373 { _DW_EVENT_SWITCH_PAGE, DW_SIGNAL_SWITCH_PAGE }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
374 { _DW_EVENT_TREE_EXPAND, DW_SIGNAL_TREE_EXPAND }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
375 { _DW_EVENT_COLUMN_CLICK, DW_SIGNAL_COLUMN_CLICK }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
376 { _DW_EVENT_HTML_RESULT, DW_SIGNAL_HTML_RESULT }, |
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
377 { _DW_EVENT_HTML_CHANGED, DW_SIGNAL_HTML_CHANGED } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
378 }; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
379 |
2583
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
380 int _dw_event_handler1(id object, id event, int message) |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
381 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
382 DWSignalHandler *handler = _dw_get_handler(object, message); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
383 /* 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
|
384 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
385 if(handler) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
386 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
387 switch(message) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
388 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
389 /* Timer event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
390 case _DW_EVENT_TIMER: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
391 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
392 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
|
393 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
394 if(!timerfunc(handler->data)) |
2591
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
395 dw_timer_disconnect(handler->window); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
396 return 0; |
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 /* Configure/Resize event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
399 case _DW_EVENT_CONFIGURE: |
2372
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 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
|
402 CGSize size; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
403 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
404 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
|
405 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
406 UIWindow *window = object; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
407 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
|
408 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
409 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
410 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
411 UIView *view = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
412 size = [view frame].size; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
413 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
414 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
415 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
|
416 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
417 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
|
418 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
419 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
420 } |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
421 case _DW_EVENT_KEY_PRESS: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
422 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
423 int (*keypressfunc)(HWND, char, int, int, void *, char *) = handler->signalfunction; |
2583
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
424 int special = 0; |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
425 NSString *nchar = @""; |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
426 if (@available(iOS 13.4, *)) { |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
427 UIKey *key = event; |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
428 |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
429 nchar = [key charactersIgnoringModifiers]; |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
430 special = (int)[key modifierFlags]; |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
431 } else { |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
432 // Probably won't even get here if not 13.4 |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
433 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
434 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
|
435 char *utf8 = NULL, ch = '\0'; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
436 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
437 /* Handle a valid key */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
438 if([nchar length] == 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
439 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
440 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
|
441 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
|
442 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
443 ch = tmp[0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
444 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
445 utf8 = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
446 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
447 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
448 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
|
449 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
450 /* Button press and release event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
451 case _DW_EVENT_BUTTON_PRESS: |
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
452 case _DW_EVENT_BUTTON_RELEASE: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
453 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
454 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; |
2610
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
455 /* Event will be nil when handling the context menu events... |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
456 * So button should default to 2 if event is nil |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
457 */ |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
458 int button = event ? 1 : 2; |
2606
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
459 CGPoint p = _dw_event_point; |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
460 |
2610
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
461 if(event && [event isKindOfClass:[UIEvent class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
462 { |
2610
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
463 NSSet *touches = [event allTouches]; |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
464 |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
465 for(id touch in touches) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
466 { |
2610
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
467 if((message == 3 && [touch phase] == UITouchPhaseBegan) || |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
468 (message == 4 && [touch phase] == UITouchPhaseEnded)) |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
469 { |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
470 p = [touch locationInView:[touch view]]; |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
471 |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
472 if(@available(ios 13.4, *)) |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
473 { |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
474 if([event buttonMask] & UIEventButtonMaskSecondary) |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
475 button = 2; |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
476 } |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
477 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
478 } |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
481 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
|
482 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
483 /* Motion notify event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
484 case _DW_EVENT_MOTION_NOTIFY: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
485 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
486 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; |
2610
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
487 int button = 1; |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
488 |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
489 if(event && [event isKindOfClass:[UIEvent class]]) |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
490 { |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
491 NSSet *touches = [event allTouches]; |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
492 |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
493 for(id touch in touches) |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
494 { |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
495 if([touch phase] == UITouchPhaseMoved) |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
496 { |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
497 CGPoint p = [touch locationInView:[touch view]]; |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
498 |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
499 return motionfunc(object, (int)p.x, (int)p.y, button, handler->data); |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
500 } |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
501 } |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
502 } |
2583
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
503 return -1; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
504 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
505 /* Window close event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
506 case _DW_EVENT_DELETE: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
507 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
508 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
|
509 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
|
510 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
511 /* Window expose/draw event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
512 case _DW_EVENT_EXPOSE: |
2372
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 DWExpose exp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
515 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
|
516 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
|
517 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
518 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
|
519 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
|
520 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
|
521 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
|
522 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
|
523 return result; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
524 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
525 /* Clicked event for buttons and menu items */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
526 case _DW_EVENT_CLICKED: |
2372
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 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
|
529 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
530 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
|
531 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
532 /* Container class selection event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
533 case _DW_EVENT_ITEM_ENTER: |
2372
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 int (*containerselectfunc)(HWND, char *, void *, void *) = handler->signalfunction; |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
536 |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
537 return containerselectfunc(handler->window, [event pointerAtIndex:0], handler->data, |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
538 [event pointerAtIndex:1]); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
539 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
540 /* Container context menu event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
541 case _DW_EVENT_ITEM_CONTEXT: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
542 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
543 int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))handler->signalfunction; |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
544 char *text = (char *)[event pointerAtIndex:0]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
545 void *user = [event pointerAtIndex:1]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
546 int x = DW_POINTER_TO_INT([event pointerAtIndex:2]); |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
547 int y = DW_POINTER_TO_INT([event pointerAtIndex:3]); |
2467
4d1f370bf65e
iOS: Pass in the coordinates and row data on container context event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2464
diff
changeset
|
548 |
4d1f370bf65e
iOS: Pass in the coordinates and row data on container context event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2464
diff
changeset
|
549 return containercontextfunc(handler->window, text, x, y, handler->data, user); |
2372
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 /* Generic selection changed event for several classes */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
552 case _DW_EVENT_LIST_SELECT: |
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
553 case _DW_EVENT_VALUE_CHANGED: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
554 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
555 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
|
556 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
|
557 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
558 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
|
559 } |
2429
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
560 /* Tree class selection event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
561 case _DW_EVENT_ITEM_SELECT: |
2429
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
562 { |
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
563 int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))handler->signalfunction; |
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
564 char *text = NULL; |
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
565 void *user = NULL; |
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
566 id item = nil; |
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
567 |
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
568 if([object isKindOfClass:[UITableView class]] && event) |
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
569 { |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
570 if([event isKindOfClass:[NSPointerArray class]]) |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
571 { |
2772
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
572 /* The NSPointerArray count will be 2 for Containers */ |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
573 text = [event pointerAtIndex:0]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
574 user = [event pointerAtIndex:1]; |
2772
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
575 |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
576 /* The NSPointerArray count will be 3 for Trees */ |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
577 if([event count] > 2) |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
578 item = [event pointerAtIndex:2]; |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
579 } |
2429
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
580 } |
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
581 |
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
582 return treeselectfunc(handler->window, item, text, handler->data, user); |
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
583 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
584 /* Set Focus event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
585 case _DW_EVENT_SET_FOCUS: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
586 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
587 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
|
588 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
589 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
|
590 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
591 /* Notebook page change event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
592 case _DW_EVENT_SWITCH_PAGE: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
593 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
594 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
|
595 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
|
596 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
597 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
|
598 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
599 /* Tree expand event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
600 case _DW_EVENT_TREE_EXPAND: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
601 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
602 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
|
603 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
604 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
|
605 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
606 /* Column click event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
607 case _DW_EVENT_COLUMN_CLICK: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
608 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
609 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
|
610 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
|
611 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
612 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
|
613 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
614 /* HTML result event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
615 case _DW_EVENT_HTML_RESULT: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
616 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
617 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
|
618 void **params = (void **)event; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
619 NSString *result = params[0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
620 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
621 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
|
622 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
623 /* HTML changed event */ |
2764
4c602db2d2cf
iOS: _dw_event_handler() switch needs to be updated using internal constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2751
diff
changeset
|
624 case _DW_EVENT_HTML_CHANGED: |
2372
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 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
|
627 void **params = (void **)event; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
628 NSString *uri = params[1]; |
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 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
|
631 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
632 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
633 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
634 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
635 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
636 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
637 /* Sub function to handle redraws */ |
2583
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
638 int _dw_event_handler(id object, id event, int message) |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
639 { |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
640 int ret = _dw_event_handler1(object, event, message); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
641 if(ret != -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
642 _dw_redraw(nil, FALSE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
643 return ret; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
644 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
645 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
646 /* 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
|
647 @interface DWTimerHandler : NSObject { } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
648 -(void)runTimer:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
649 @end |
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 @implementation DWTimerHandler |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
652 -(void)runTimer:(id)sender { _dw_event_handler(sender, nil, _DW_EVENT_TIMER); } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
653 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
654 |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
655 @interface DWAppDel : UIResponder <UIApplicationDelegate> { } |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
656 -(void)applicationWillTerminate:(UIApplication *)application; |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
657 -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions; |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
658 @end |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
659 |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
660 @implementation DWAppDel |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
661 -(void)applicationWillTerminate:(UIApplication *)application |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
662 { |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
663 /* On iOS we can't prevent temrination, but send the notificatoin anyway */ |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
664 _dw_event_handler(application, nil, _DW_EVENT_DELETE); |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
665 } |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
666 -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
667 { |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
668 return true; |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
669 } |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
670 @end |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
671 |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
672 static UIApplication *DWApp = nil; |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
673 static UIFont *DWDefaultFont; |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
674 static DWTimerHandler *DWHandler; |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
675 static NSMutableArray *_DWDirtyDrawables; |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
676 static DWTID DWThread = (DWTID)-1; |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
677 static HEV DWMainEvent; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
678 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
679 /* Used for doing bitblts from the main thread */ |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
680 typedef struct _dw_bitbltinfo |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
681 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
682 id src; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
683 id dest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
684 int xdest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
685 int ydest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
686 int width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
687 int height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
688 int xsrc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
689 int ysrc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
690 int srcwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
691 int srcheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
692 } DWBitBlt; |
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 /* Subclass for a test object type */ |
2385
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
695 @interface DWObject : NSObject |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
696 { |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
697 /* A normally hidden window, at the top of the view hierarchy. |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
698 * Since iOS messageboxes and such require a view controller, |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
699 * we show this hidden window when necessary and use it during |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
700 * the creation of alerts and dialog boxes that don't have one. |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
701 */ |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
702 UIWindow *hiddenWindow; |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
703 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
704 -(void)uselessThread:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
705 -(void)menuHandler:(id)param; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
706 -(void)doBitBlt:(id)param; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
707 -(void)doFlush:(id)param; |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
708 -(UIWindow *)hiddenWindow; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
709 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
710 |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
711 API_AVAILABLE(ios(13.0)) |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
712 @interface DWMenu : NSObject |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
713 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
714 UIMenu *menu; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
715 NSMutableArray *children; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
716 NSString *title; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
717 unsigned long tag; |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
718 UIWindow *window; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
719 } |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
720 -(id)initWithTag:(unsigned long)newtag; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
721 -(void)setTitle:(NSString *)input; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
722 -(UIMenu *)menu; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
723 -(unsigned long)tag; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
724 -(id)childWithTag:(unsigned long)tag; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
725 -(void)addItem:(id)item; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
726 -(void)removeItem:(id)item; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
727 -(void)dealloc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
728 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
729 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
730 API_AVAILABLE(ios(13.0)) |
2604
4671ac4ad3c6
iOS: Had to switch from UIKeyCommand to UIAction for DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2603
diff
changeset
|
731 @interface DWMenuItem : UIAction |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
732 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
733 BOOL check, enabled; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
734 unsigned long tag; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
735 DWMenu *submenu, *menu; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
736 } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
737 -(void)setCheck:(BOOL)input; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
738 -(void)setEnabled:(BOOL)input; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
739 -(void)setTag:(unsigned long)input; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
740 -(void)setSubmenu:(DWMenu *)input; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
741 -(void)setMenu:(DWMenu *)input; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
742 -(DWMenu *)submenu; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
743 -(DWMenu *)menu; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
744 -(BOOL)check; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
745 -(BOOL)enabled; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
746 -(unsigned long)tag; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
747 -(void)dealloc; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
748 @end |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
749 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
750 /* 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
|
751 * 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
|
752 * 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
|
753 * 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
|
754 * 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
|
755 * going to work. -Brian |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
756 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
757 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
758 /* 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
|
759 @interface DWBox : UIView |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
760 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
761 Box *box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
762 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
763 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
764 -(id)init; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
765 -(void)dealloc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
766 -(Box *)box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
767 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
768 -(void)setUserdata:(void *)input; |
2583
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
769 -(void)keyDown:(UIKey *)key API_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
|
770 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
771 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
772 @implementation DWBox |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
773 -(id)init |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
774 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
775 self = [super init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
776 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
777 if (self) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
778 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
779 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
|
780 box->type = DW_VERT; |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
781 box->vsize = box->hsize = _DW_SIZE_EXPAND; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
782 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
|
783 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
784 return self; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
785 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
786 -(void)dealloc |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
787 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
788 UserData *root = userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
789 if(box->items) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
790 free(box->items); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
791 free(box); |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
792 _dw_remove_userdata(&root, NULL, TRUE); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
793 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
|
794 [super dealloc]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
795 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
796 -(Box *)box { return box; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
797 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
798 -(void)setUserdata:(void *)input { userdata = input; } |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
799 -(void)keyDown:(UIKey *)key API_AVAILABLE(ios(13.4)){ _dw_event_handler(self, key, _DW_EVENT_KEY_PRESS); } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
800 @end |
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 @interface DWWindow : UIWindow |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
803 { |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
804 DWMenu *windowmenu, *popupmenu; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
805 int shown; |
2739
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
806 void *userdata; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
807 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
808 -(void)sendEvent:(UIEvent *)theEvent; |
2583
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
809 -(void)keyDown:(UIKey *)key API_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
|
810 -(int)shown; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
811 -(void)setShown:(int)val; |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
812 -(void)layoutSubviews; |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
813 -(void)setMenu:(DWMenu *)input; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
814 -(void)setPopupMenu:(DWMenu *)input; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
815 -(DWMenu *)menu; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
816 -(DWMenu *)popupMenu; |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
817 -(void)updateMenu; |
2739
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
818 -(void *)userdata; |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
819 -(void)setUserdata:(void *)input; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
820 @end |
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 @implementation DWWindow |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
823 -(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
|
824 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
825 int rcode = -1; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
826 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
|
827 { |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
828 rcode = _dw_event_handler(self, theEvent, _DW_EVENT_KEY_PRESS); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
829 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
830 if ( rcode != TRUE ) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
831 [super sendEvent:theEvent]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
832 } |
2583
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
833 -(void)keyDown:(UIKey *)key { } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
834 -(int)shown { return shown; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
835 -(void)setShown:(int)val { shown = val; } |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
836 -(void)layoutSubviews { } |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
837 -(void)setMenu:(DWMenu *)input { [windowmenu release]; windowmenu = input; [windowmenu retain]; } |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
838 -(void)setPopupMenu:(DWMenu *)input { [popupmenu release]; popupmenu = input; [popupmenu retain]; } |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
839 -(void)updateMenu |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
840 { |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
841 if(windowmenu) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
842 { |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
843 NSArray *array = [[[self rootViewController] view] subviews]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
844 UINavigationBar *nav = nil; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
845 |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
846 for(id obj in array) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
847 { |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
848 if([obj isMemberOfClass:[UINavigationBar class]]) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
849 nav = obj; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
850 } |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
851 if(nav) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
852 { |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
853 UINavigationItem *item = [[nav items] firstObject]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
854 |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
855 if (@available(iOS 14.0, *)) { |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
856 if(item && item.rightBarButtonItem && item.rightBarButtonItem.menu) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
857 [item.rightBarButtonItem setMenu:[windowmenu menu]]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
858 } |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
859 } |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
860 } |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
861 } |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
862 -(DWMenu *)menu { return windowmenu; } |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
863 -(DWMenu *)popupMenu { return popupmenu; } |
2638
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
864 -(void)closeWindow:(id)sender |
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
865 { |
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
866 if(_dw_event_handler(self, nil, _DW_EVENT_DELETE) < 1) |
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
867 dw_window_destroy(self); |
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
868 } |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
869 -(void)dealloc |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
870 { |
2739
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
871 UserData *root = userdata; |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
872 _dw_remove_userdata(&root, NULL, TRUE); |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
873 if(windowmenu) |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
874 [windowmenu release]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
875 if(popupmenu) |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
876 [popupmenu release]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
877 dw_signal_disconnect_by_window(self); |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
878 [super dealloc]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
879 } |
2739
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
880 -(void *)userdata { return userdata; } |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
881 -(void)setUserdata:(void *)input { userdata = input; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
882 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
883 |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
884 @interface DWImage : NSObject |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
885 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
886 UIImage *image; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
887 CGContextRef cgcontext; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
888 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
889 -(id)initWithSize:(CGSize)size; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
890 -(id)initWithCGImage:(CGImageRef)cgimage; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
891 -(id)initWithUIImage:(UIImage *)newimage; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
892 -(void)setImage:(UIImage *)input; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
893 -(UIImage *)image; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
894 -(CGContextRef)cgcontext; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
895 -(void)dealloc; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
896 @end |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
897 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
898 /* Subclass for a render area type */ |
2606
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
899 @interface DWRender : UIView <UIContextMenuInteractionDelegate> |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
900 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
901 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
902 UIFont *font; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
903 CGSize size; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
904 DWImage *cachedImage; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
905 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
906 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
907 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
908 -(void)setFont:(UIFont *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
909 -(UIFont *)font; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
910 -(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
|
911 -(CGSize)size; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
912 -(DWImage *)cachedImage; |
2583
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
913 -(void)keyDown:(UIKey *)key API_AVAILABLE(ios(13.4)); |
2606
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
914 -(UIContextMenuConfiguration *)contextMenuInteraction:(UIContextMenuInteraction *)interaction configurationForMenuAtLocation:(CGPoint)location; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
915 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
916 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
917 @implementation DWRender |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
918 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
919 -(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
|
920 -(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
|
921 -(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
|
922 -(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
|
923 size = input; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
924 if(cachedImage) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
925 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
926 DWImage *oldimage = cachedImage; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
927 UIImage *newimage; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
928 UIGraphicsBeginImageContext(self.frame.size); |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
929 [[self layer] renderInContext:UIGraphicsGetCurrentContext()]; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
930 newimage = UIGraphicsGetImageFromCurrentImageContext(); |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
931 UIGraphicsEndImageContext(); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
932 cachedImage = [[DWImage alloc] initWithUIImage:newimage]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
933 [cachedImage retain]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
934 [oldimage release]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
935 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
936 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
937 -(CGSize)size { return size; } |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
938 -(DWImage *)cachedImage { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
939 if(!cachedImage) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
940 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
941 UIImage *newimage; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
942 UIGraphicsBeginImageContext(self.frame.size); |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
943 [[self layer] renderInContext:UIGraphicsGetCurrentContext()]; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
944 newimage = UIGraphicsGetImageFromCurrentImageContext(); |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
945 UIGraphicsEndImageContext(); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
946 cachedImage = [[DWImage alloc] initWithUIImage:newimage]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
947 [cachedImage retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
948 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
949 /* 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
|
950 if(![_DWDirtyDrawables containsObject:self]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
951 [_DWDirtyDrawables addObject:self]; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
952 return cachedImage; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
953 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
954 -(void)drawRect:(CGRect)rect { |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
955 _dw_event_handler(self, nil, _DW_EVENT_EXPOSE); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
956 if(cachedImage) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
957 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
958 [[cachedImage image] drawInRect:self.bounds]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
959 [_DWDirtyDrawables removeObject:self]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
960 [self setNeedsDisplay]; |
2372
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 } |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
963 -(void)keyDown:(UIKey *)key API_AVAILABLE(ios(13.4)){ _dw_event_handler(self, key, _DW_EVENT_KEY_PRESS); } |
2610
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
964 -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
965 { |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
966 _dw_event_handler(self, event, _DW_EVENT_BUTTON_PRESS); |
2610
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
967 [super touchesBegan:touches withEvent:event]; |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
968 } |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
969 -(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
970 { |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
971 _dw_event_handler(self, event, _DW_EVENT_BUTTON_RELEASE); |
2610
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
972 [super touchesEnded:touches withEvent:event]; |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
973 } |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
974 -(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
975 { |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
976 _dw_event_handler(self, event, _DW_EVENT_MOTION_NOTIFY); |
2610
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
977 [super touchesMoved:touches withEvent:event]; |
da51be036599
iOS: Implement button press/release and motion notify.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2606
diff
changeset
|
978 } |
2606
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
979 -(UIContextMenuConfiguration *)contextMenuInteraction:(UIContextMenuInteraction *)interaction configurationForMenuAtLocation:(CGPoint)location |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
980 { |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
981 DWWindow *window = (DWWindow *)[self window]; |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
982 UIContextMenuConfiguration *config = nil; |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
983 |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
984 _dw_event_point = location; |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
985 _dw_event_handler(self, nil, _DW_EVENT_BUTTON_PRESS); |
2606
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
986 |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
987 if(window && [window popupMenu]) |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
988 { |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
989 __block UIMenu *popupmenu = [[[window popupMenu] menu] retain]; |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
990 config = [UIContextMenuConfiguration configurationWithIdentifier:nil |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
991 previewProvider:nil |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
992 actionProvider:^(NSArray* suggestedAction){return popupmenu;}]; |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
993 [window setPopupMenu:nil]; |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
994 } |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
995 return config; |
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
996 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
997 -(void)dealloc { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
998 UserData *root = userdata; |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
999 _dw_remove_userdata(&root, NULL, TRUE); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1000 [font release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1001 dw_signal_disconnect_by_window(self); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1002 [cachedImage release]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1003 [_DWDirtyDrawables removeObject:self]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1004 [super dealloc]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1005 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1006 -(BOOL)acceptsFirstResponder { return YES; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1007 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1008 |
2726
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1009 /* Subclass page renderer to implement page by page rendering */ |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1010 @interface DWPrintPageRenderer : UIPrintPageRenderer |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1011 { |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1012 int (*drawfunc)(HPRINT, HPIXMAP, int, void *); |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1013 void *drawdata; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1014 unsigned long flags; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1015 unsigned int pages; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1016 HPRINT *print; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1017 } |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1018 -(void)setDrawFunc:(void *)input; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1019 -(void)setDrawData:(void *)input; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1020 -(void *)drawData; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1021 -(void)setFlags:(unsigned long)input; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1022 -(unsigned long)flags; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1023 -(void)setPages:(unsigned int)input; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1024 -(void)setPrint:(HPRINT)input; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1025 @end |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1026 |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1027 @implementation DWPrintPageRenderer |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1028 -(void)setDrawFunc:(void *)input { drawfunc = input; } |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1029 -(void)setDrawData:(void *)input { drawdata = input; } |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1030 -(void *)drawData { return drawdata; } |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1031 -(void)setFlags:(unsigned long)input { flags = input; } |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1032 -(unsigned long)flags { return flags; } |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1033 -(void)setPages:(unsigned int)input { pages = input; } |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1034 -(void)setPrint:(HPRINT)input { print = input; } |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1035 -(void)drawContentForPageAtIndex:(NSInteger)pageIndex inRect:(CGRect)contentRect |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1036 { |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1037 HPIXMAP pm = dw_pixmap_new(nil, contentRect.size.width, contentRect.size.height, 32); |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1038 DWImage *image = pm->image; |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
1039 CGBlendMode op = kCGBlendModeNormal; |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
1040 |
2726
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1041 drawfunc(print, pm, (int)pageIndex, drawdata); |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
1042 [[image image] drawInRect:contentRect blendMode:op alpha:1.0]; |
2726
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1043 dw_pixmap_destroy(pm); |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1044 } |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1045 -(NSInteger)numberOfPages { return (NSInteger)pages; } |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1046 @end |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1047 |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1048 @interface DWFontPickerDelegate : UIResponder <UIFontPickerViewControllerDelegate> |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1049 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1050 DWDialog *dialog; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1051 } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1052 -(void)fontPickerViewControllerDidPickFont:(UIFontPickerViewController *)viewController; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1053 -(void)fontPickerViewControllerDidCancel:(UIFontPickerViewController *)viewController; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1054 -(void)setDialog:(DWDialog *)newdialog; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1055 @end |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1056 |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1057 @implementation DWFontPickerDelegate |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1058 -(void)fontPickerViewControllerDidPickFont:(UIFontPickerViewController *)viewController |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1059 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1060 if(viewController.selectedFontDescriptor) |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1061 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1062 UIFont *font = [UIFont fontWithDescriptor:viewController.selectedFontDescriptor size:9]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1063 dw_dialog_dismiss(dialog, font); |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1064 } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1065 else |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1066 dw_dialog_dismiss(dialog, NULL); |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1067 } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1068 -(void)fontPickerViewControllerDidCancel:(UIFontPickerViewController *)viewController |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1069 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1070 dw_dialog_dismiss(dialog, NULL); |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1071 } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1072 -(void)setDialog:(DWDialog *)newdialog { dialog = newdialog; } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1073 @end |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1074 |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1075 @interface DWColorPickerDelegate : UIResponder <UIColorPickerViewControllerDelegate> |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1076 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1077 DWDialog *dialog; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1078 } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1079 -(void)colorPickerViewControllerDidSelectColor:(UIColorPickerViewController *)viewController API_AVAILABLE(ios(14.0)); |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1080 -(void)colorPickerViewControllerDidFinish:(UIColorPickerViewController *)viewController API_AVAILABLE(ios(14.0)); |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1081 -(void)setDialog:(DWDialog *)newdialog; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1082 @end |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1083 |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1084 @implementation DWColorPickerDelegate |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1085 -(void)colorPickerViewControllerDidSelectColor:(UIColorPickerViewController *)viewController API_AVAILABLE(ios(14.0)) |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1086 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1087 if([viewController selectedColor]) |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1088 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1089 CGFloat red, green, blue; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1090 [[viewController selectedColor] getRed:&red green:&green blue:&blue alpha:NULL]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1091 dw_dialog_dismiss(dialog, DW_UINT_TO_POINTER(DW_RGB((int)(red * 255), (int)(green *255), (int)(blue *255)))); |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1092 } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1093 else |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1094 dw_dialog_dismiss(dialog, NULL); |
2415
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1095 [viewController dismissViewControllerAnimated:YES completion:nil]; |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1096 } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1097 -(void)colorPickerViewControllerDidFinish:(UIColorPickerViewController *)viewController API_AVAILABLE(ios(14.0)) |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1098 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1099 dw_dialog_dismiss(dialog, NULL); |
2415
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1100 [viewController dismissViewControllerAnimated:YES completion:nil]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1101 } |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1102 -(void)setDialog:(DWDialog *)newdialog { dialog = newdialog; } |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1103 @end |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1104 |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1105 @interface DWDocumentPickerDelegate : UIResponder <UIDocumentPickerDelegate> |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1106 { |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1107 DWDialog *dialog; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1108 } |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1109 -(void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1110 -(void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1111 -(void)setDialog:(DWDialog *)newdialog; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1112 @end |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1113 |
2786
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1114 #define _DW_URL_LIMIT 10 |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1115 static NSMutableArray *_dw_URLs = nil; |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1116 |
2415
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1117 @implementation DWDocumentPickerDelegate |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1118 -(void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1119 { |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1120 NSURL *url = [urls firstObject]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1121 char *file = NULL; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1122 |
2593
cc2befdc97e8
iOS: Switch to using the NSURL fileSystemRepresentation method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2591
diff
changeset
|
1123 if(url) |
cc2befdc97e8
iOS: Switch to using the NSURL fileSystemRepresentation method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2591
diff
changeset
|
1124 { |
cc2befdc97e8
iOS: Switch to using the NSURL fileSystemRepresentation method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2591
diff
changeset
|
1125 const char *tmp = [url fileSystemRepresentation]; |
2445
a773008c7c5d
iOS: Make sure the plain text UTI is used with filePicker.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2444
diff
changeset
|
1126 |
2786
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1127 if(tmp && [url startAccessingSecurityScopedResource]) |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1128 { |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1129 /* We need to allow access to the returned URLs on iOS 13 |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1130 * but we have no way of knowing when it is no longer needed... |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1131 * since the C API we are connected to does not have that information. |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1132 * So maintain a list of URLs, and when the list exceeds the limit... |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1133 * revoke access to the oldest URL. |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1134 */ |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1135 if(!_dw_URLs) |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1136 _dw_URLs = [[[NSMutableArray alloc] init] retain]; |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1137 if(_dw_URLs) |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1138 { |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1139 if([_dw_URLs count] >= _DW_URL_LIMIT) |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1140 { |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1141 NSURL *oldurl = [_dw_URLs firstObject]; |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1142 [oldurl stopAccessingSecurityScopedResource]; |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1143 [_dw_URLs removeObject:oldurl]; |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1144 } |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1145 [_dw_URLs addObject:url]; |
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1146 } |
2593
cc2befdc97e8
iOS: Switch to using the NSURL fileSystemRepresentation method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2591
diff
changeset
|
1147 file = strdup(tmp); |
2786
3934ac8b394c
iOS: Make dw_file_browse() grant access to security scoped resources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2772
diff
changeset
|
1148 } |
2445
a773008c7c5d
iOS: Make sure the plain text UTI is used with filePicker.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2444
diff
changeset
|
1149 } |
2415
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1150 dw_dialog_dismiss(dialog, file); |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1151 } |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1152 -(void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1153 { |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1154 dw_dialog_dismiss(dialog, NULL); |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1155 } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1156 -(void)setDialog:(DWDialog *)newdialog { dialog = newdialog; } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1157 @end |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1158 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1159 @implementation DWObject |
2385
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
1160 -(id)init |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
1161 { |
2395
2618277de356
iOS: Code error cleanup reported by LLVM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2393
diff
changeset
|
1162 self = [super init]; |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1163 /* This previously had the code in delayedIinit: */ |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1164 return self; |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1165 } |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1166 -(void)delayedInit:(id)param |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1167 { |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1168 /* When DWObject is initialized, UIApplicationMain() has not yet been called... |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1169 * So the created objects can't interact with the user interface... therefore |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1170 * we wait until UIApplicationMain() has been called and run this then. |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1171 */ |
2385
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
1172 hiddenWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1173 [hiddenWindow setWindowLevel:UIWindowLevelAlert+1]; |
2385
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
1174 [hiddenWindow setHidden:YES]; |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1175 [hiddenWindow setRootViewController:[UIViewController new]]; |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1176 /* Handle setting the dark mode state now that DWObj is valid */ |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1177 if(_dw_dark_mode_state != DW_FEATURE_UNSUPPORTED) |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1178 dw_feature_set(DW_FEATURE_DARK_MODE, _dw_dark_mode_state); |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1179 } |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1180 -(UIWindow *)hiddenWindow { return hiddenWindow; }; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1181 -(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
|
1182 -(void)menuHandler:(id)param |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1183 { |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
1184 _dw_event_handler(param, nil, _DW_EVENT_CLICKED); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1185 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1186 -(void)callBack:(NSPointerArray *)params |
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 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
|
1189 if(mycallback) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1190 mycallback(params); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1191 } |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1192 -(void)colorPicker:(NSMutableArray *)params |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1193 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1194 if (@available(iOS 14.0, *)) |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1195 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1196 DWDialog *dialog = dw_dialog_new(NULL); |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1197 UIColorPickerViewController *picker = [[UIColorPickerViewController alloc] init]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1198 DWColorPickerDelegate *delegate = [[DWColorPickerDelegate alloc] init]; |
2723
27fd270cb0db
iOS: Implement initial color in the color picker dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2718
diff
changeset
|
1199 unsigned long color = [[params firstObject] unsignedLongValue]; |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1200 |
2415
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1201 /* Setup our picker */ |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1202 [picker setSupportsAlpha:NO]; |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1203 /* Unhide our hidden window and make it key */ |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1204 [hiddenWindow setHidden:NO]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1205 [hiddenWindow makeKeyAndVisible]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1206 [delegate setDialog:dialog]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1207 [picker setDelegate:delegate]; |
2723
27fd270cb0db
iOS: Implement initial color in the color picker dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2718
diff
changeset
|
1208 [picker setSelectedColor:[UIColor colorWithRed: DW_RED_VALUE(color)/255.0 green: DW_GREEN_VALUE(color)/255.0 blue: DW_BLUE_VALUE(color)/255.0 alpha: 1]]; |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1209 /* Wait for them to pick a color */ |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1210 [[hiddenWindow rootViewController] presentViewController:picker animated:YES completion:nil]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1211 [params addObject:[NSNumber numberWithUnsignedLong:DW_POINTER_TO_UINT(dw_dialog_wait(dialog))]]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1212 /* Once the dialog is gone we can rehide our window */ |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1213 [hiddenWindow resignKeyWindow]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1214 [hiddenWindow setHidden:YES]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1215 [picker release]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1216 [delegate release]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1217 } else { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1218 // Fallback on earlier versions |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1219 }; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1220 } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1221 -(void)fontPicker:(NSPointerArray *)params |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1222 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1223 DWDialog *dialog = dw_dialog_new(NULL); |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1224 UIFontPickerViewController *picker = [[UIFontPickerViewController alloc] init]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1225 DWFontPickerDelegate *delegate = [[DWFontPickerDelegate alloc] init]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1226 UIFont *font; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1227 |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1228 /* Unhide our hidden window and make it key */ |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1229 [hiddenWindow setHidden:NO]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1230 [hiddenWindow makeKeyAndVisible]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1231 [delegate setDialog:dialog]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1232 [picker setDelegate:delegate]; |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
1233 /* Wait for them to pick a font */ |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1234 [[hiddenWindow rootViewController] presentViewController:picker animated:YES completion:nil]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1235 font = dw_dialog_wait(dialog); |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1236 /* Once the dialog is gone we can rehide our window */ |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1237 [hiddenWindow resignKeyWindow]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1238 [hiddenWindow setHidden:YES]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1239 |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1240 if(font) |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1241 { |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1242 NSString *fontname = [font fontName]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1243 NSString *output = [NSString stringWithFormat:@"%d.%s", (int)[font pointSize], [fontname UTF8String]]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1244 [params addPointer:strdup([output UTF8String])]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1245 } |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1246 else |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1247 [params addPointer:NULL]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1248 [picker release]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1249 [delegate release]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
1250 } |
2415
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1251 -(void)filePicker:(NSPointerArray *)params |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1252 { |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1253 DWDialog *dialog = dw_dialog_new(NULL); |
2712
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1254 UIDocumentPickerViewController *picker; |
2415
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1255 DWDocumentPickerDelegate *delegate = [[DWDocumentPickerDelegate alloc] init]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1256 char *defpath = [params pointerAtIndex:0]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1257 char *ext = [params pointerAtIndex:1]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1258 int flags = DW_POINTER_TO_INT([params pointerAtIndex:2]); |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1259 char *file = NULL; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1260 NSArray *UTIs; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1261 |
2712
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1262 if (@available(iOS 14, *)) { |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1263 UTType *extuti = ext ? [UTType typeWithFilenameExtension:[NSString stringWithUTF8String:ext]] : nil; |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1264 |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1265 /* Try to generate a UTI for our passed extension */ |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1266 if(flags & DW_DIRECTORY_OPEN) |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1267 UTIs = @[UTTypeFolder]; |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1268 else |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1269 { |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1270 if(extuti) |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1271 UTIs = [NSArray arrayWithObjects:extuti, UTTypeText, nil]; |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1272 else |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1273 UTIs = @[UTTypeText]; |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1274 } |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1275 picker = [[UIDocumentPickerViewController alloc] initForOpeningContentTypes:UTIs |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1276 asCopy:(flags & DW_FILE_SAVE ? YES: NO)]; |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1277 } else { |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1278 UIDocumentPickerMode mode = UIDocumentPickerModeOpen; |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1279 |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1280 /* Try to generate a UTI for our passed extension */ |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1281 if(flags & DW_DIRECTORY_OPEN) |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1282 UTIs = @[@"public.directory"]; |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1283 else |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1284 { |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1285 if(ext) |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1286 UTIs = [NSArray arrayWithObjects:[NSString stringWithFormat:@"public.%s", ext], @"public.text", nil]; |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1287 else |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1288 UTIs = @[@"public.text"]; |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1289 } |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1290 |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1291 /* Setup the picker */ |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1292 if(flags & DW_FILE_SAVE) |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1293 mode = UIDocumentPickerModeExportToService; |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1294 |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1295 picker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:UTIs inMode:mode]; |
ada3ac4677f6
iOS: Add file browser support for selecting folders/directories.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2711
diff
changeset
|
1296 } |
2415
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1297 [picker setAllowsMultipleSelection:NO]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1298 [picker setShouldShowFileExtensions:YES]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1299 if(defpath) |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1300 [picker setDirectoryURL:[NSURL URLWithString:[NSString stringWithUTF8String:defpath]]]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1301 /* Unhide our hidden window and make it key */ |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1302 [hiddenWindow setHidden:NO]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1303 [hiddenWindow makeKeyAndVisible]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1304 [delegate setDialog:dialog]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1305 [picker setDelegate:delegate]; |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
1306 /* Wait for them to pick a file */ |
2415
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1307 [[hiddenWindow rootViewController] presentViewController:picker animated:YES completion:nil]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1308 file = dw_dialog_wait(dialog); |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1309 /* Once the dialog is gone we can rehide our window */ |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1310 [hiddenWindow resignKeyWindow]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1311 [hiddenWindow setHidden:YES]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1312 [params addPointer:file]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1313 [picker release]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1314 [delegate release]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
1315 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1316 -(void)messageBox:(NSMutableArray *)params |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1317 { |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1318 __block DWDialog *dialog = dw_dialog_new(NULL); |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1319 NSInteger iResponse; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1320 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
|
1321 message:[params objectAtIndex:1] |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1322 preferredStyle:[[params objectAtIndex:2] integerValue]]; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1323 UIAlertAction* action = [UIAlertAction actionWithTitle:[params objectAtIndex:3] style:UIAlertActionStyleDefault |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1324 handler:^(UIAlertAction * action) { dw_dialog_dismiss(dialog, DW_INT_TO_POINTER(1)); }]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1325 [alert addAction:action]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1326 if([params count] > 4) |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1327 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1328 action = [UIAlertAction actionWithTitle:[params objectAtIndex:4] style:UIAlertActionStyleDefault |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1329 handler:^(UIAlertAction * action) { dw_dialog_dismiss(dialog, DW_INT_TO_POINTER(2)); }]; |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1330 [alert addAction:action]; |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1331 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1332 if([params count] > 5) |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1333 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1334 action = [UIAlertAction actionWithTitle:[params objectAtIndex:5] style:UIAlertActionStyleDefault |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1335 handler:^(UIAlertAction * action) { dw_dialog_dismiss(dialog, DW_INT_TO_POINTER(3)); }]; |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1336 [alert addAction:action]; |
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1337 } |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1338 |
2385
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
1339 /* Unhide our hidden window and make it key */ |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
1340 [hiddenWindow setHidden:NO]; |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
1341 [hiddenWindow makeKeyAndVisible]; |
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
1342 [[hiddenWindow rootViewController] presentViewController:alert animated:YES completion:nil]; |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1343 iResponse = DW_POINTER_TO_INT(dw_dialog_wait(dialog)); |
2385
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
1344 /* Once the dialog is gone we can rehide our window */ |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
1345 [hiddenWindow resignKeyWindow]; |
2385
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
1346 [hiddenWindow setHidden:YES]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1347 [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
|
1348 } |
2726
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1349 -(void)printDialog:(NSMutableArray *)params |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1350 { |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1351 __block DWDialog *dialog = dw_dialog_new(NULL); |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1352 UIPrintInteractionController *pc = [UIPrintInteractionController sharedPrintController]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1353 UIPrintInfo *pi = [params firstObject]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1354 DWPrintPageRenderer *renderer = [params objectAtIndex:1]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1355 /* Not currently using the passed in flags, but when we need them... |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1356 NSNumber *flags = [params objectAtIndex:2];*/ |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1357 int result = DW_ERROR_UNKNOWN; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1358 |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1359 /* Setup our print dialog */ |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1360 [pc setPrintInfo:pi]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1361 [pc setPrintPageRenderer:renderer]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1362 |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1363 /* Present the shared printer dialog */ |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1364 [pc presentAnimated:YES completionHandler:^(UIPrintInteractionController * _Nonnull printInteractionController, BOOL completed, NSError * _Nullable error) { |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1365 dw_dialog_dismiss(dialog, DW_INT_TO_POINTER((completed ? DW_ERROR_NONE : DW_ERROR_UNKNOWN))); |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1366 }]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1367 result = DW_POINTER_TO_INT(dw_dialog_wait(dialog)); |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1368 |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1369 [params addObject:[NSNumber numberWithInteger:result]]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
1370 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1371 -(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
|
1372 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1373 if([self respondsToSelector:sel]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1374 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1375 DWTID curr = pthread_self(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1376 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1377 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
|
1378 [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
|
1379 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1380 [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
|
1381 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1382 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1383 -(void)doBitBlt:(id)param |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1384 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1385 NSValue *bi = (NSValue *)param; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1386 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
|
1387 id bltdest = bltinfo->dest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1388 id bltsrc = bltinfo->src; |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
1389 CGContextRef context = _dw_draw_context(bltdest, NO); |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
1390 |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
1391 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
1392 UIGraphicsPushContext(context); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1393 |
2437
929ce3cd18ea
iOS: Fix bitblt and crashes due to missing retains.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2436
diff
changeset
|
1394 if(bltdest && [bltsrc isMemberOfClass:[DWImage class]]) |
929ce3cd18ea
iOS: Fix bitblt and crashes due to missing retains.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2436
diff
changeset
|
1395 { |
929ce3cd18ea
iOS: Fix bitblt and crashes due to missing retains.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2436
diff
changeset
|
1396 DWImage *rep = bltsrc; |
929ce3cd18ea
iOS: Fix bitblt and crashes due to missing retains.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2436
diff
changeset
|
1397 UIImage *image = [rep image]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1398 CGBlendMode op = kCGBlendModeNormal; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1399 |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1400 if(bltinfo->srcwidth != -1) |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1401 { |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1402 [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
|
1403 /*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
|
1404 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
|
1405 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1406 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1407 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1408 [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
|
1409 /*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
|
1410 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
|
1411 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1412 } |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
1413 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
1414 UIGraphicsPopContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1415 free(bltinfo); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1416 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1417 -(void)doFlush:(id)param |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1418 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1419 NSEnumerator *enumerator = [_DWDirtyDrawables objectEnumerator]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1420 DWRender *rend; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1421 |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1422 while(rend = [enumerator nextObject]) |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1423 [rend setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1424 [_DWDirtyDrawables removeAllObjects]; |
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 -(void)doWindowFunc:(id)param |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1427 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1428 NSValue *v = (NSValue *)param; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1429 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
|
1430 void (* windowfunc)(void *); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1431 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1432 if(params) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1433 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1434 windowfunc = params[0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1435 if(windowfunc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1436 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1437 windowfunc(params[1]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1438 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1439 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1440 } |
2458
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1441 -(void)getUserInterfaceStyle:(id)param |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1442 { |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1443 NSMutableArray *array = param; |
2459
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1444 UIUserInterfaceStyle overridestyle = [hiddenWindow overrideUserInterfaceStyle]; |
2458
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1445 int retval; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1446 |
2459
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1447 switch(overridestyle) |
2458
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1448 { |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1449 case UIUserInterfaceStyleLight: |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1450 retval = DW_DARK_MODE_DISABLED; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1451 break; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1452 case UIUserInterfaceStyleDark: |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1453 retval = DW_DARK_MODE_FORCED; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1454 break; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1455 default: /* UIUserInterfaceStyleUnspecified */ |
2459
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1456 { |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1457 UIUserInterfaceStyle style = [[[hiddenWindow rootViewController] traitCollection] userInterfaceStyle]; |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1458 |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1459 switch(style) |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1460 { |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1461 case UIUserInterfaceStyleLight: |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1462 retval = DW_DARK_MODE_BASIC; |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1463 break; |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1464 case UIUserInterfaceStyleDark: |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1465 retval = DW_DARK_MODE_FULL; |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1466 break; |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1467 default: /* UIUserInterfaceStyleUnspecified */ |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1468 retval = DW_FEATURE_UNSUPPORTED; |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1469 break; |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1470 } |
ddc6d49d1110
iOS: Reorganize the code so retval doesn't get clobbered without the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2458
diff
changeset
|
1471 } |
2458
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1472 } |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1473 [array addObject:[NSNumber numberWithInt:retval]]; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1474 } |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1475 -(void)setUserInterfaceStyle:(id)param |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1476 { |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1477 NSNumber *number = param; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1478 UIUserInterfaceStyle style = [number intValue]; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1479 |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1480 [hiddenWindow setOverrideUserInterfaceStyle:style]; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
1481 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1482 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1483 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1484 DWObject *DWObj; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1485 |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1486 /* Returns TRUE if iOS 12+ is in Dark Mode */ |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1487 BOOL _dw_is_dark(void) |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1488 { |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1489 if([[[[DWObj hiddenWindow] rootViewController] traitCollection] userInterfaceStyle] == UIUserInterfaceStyleDark) |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1490 return YES; |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1491 return NO; |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1492 } |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
1493 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1494 @interface DWWebView : WKWebView <WKNavigationDelegate> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1495 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1496 void *userdata; |
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 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1499 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1500 -(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
|
1501 -(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
|
1502 -(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
|
1503 -(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
|
1504 @end |
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 @implementation DWWebView : WKWebView |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1507 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1508 -(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
|
1509 -(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
|
1510 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1511 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_STARTED), [[self URL] absoluteString] }; |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
1512 _dw_event_handler(self, (id)params, _DW_EVENT_HTML_CHANGED); |
2372
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 -(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
|
1515 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1516 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_COMPLETE), [[self URL] absoluteString] }; |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
1517 _dw_event_handler(self, (id)params, _DW_EVENT_HTML_CHANGED); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1518 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1519 -(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
|
1520 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1521 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_LOADING), [[self URL] absoluteString] }; |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
1522 _dw_event_handler(self, (id)params, _DW_EVENT_HTML_CHANGED); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1523 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1524 -(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
|
1525 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1526 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_REDIRECT), [[self URL] absoluteString] }; |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
1527 _dw_event_handler(self, (id)params, _DW_EVENT_HTML_CHANGED); |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1528 } |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1529 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1530 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1531 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1532 /* 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
|
1533 @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
|
1534 { |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1535 CGSize oldsize; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1536 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1537 -(void)windowDidBecomeMain:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1538 -(void)menuHandler:(id)sender; |
2598
4a5364fe65b7
iOS: Add some code to include DWViewController in the UIResponder chain.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2593
diff
changeset
|
1539 -(UIResponder *)nextResponder; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1540 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1541 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1542 @implementation DWView |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
1543 -(void)willMoveToSuperview:(UIView *)newSuperview |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
1544 { |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
1545 if(newSuperview) |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
1546 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeMain:) name:UIWindowDidBecomeKeyNotification object:[newSuperview window]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1547 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1548 -(void)dealloc |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1549 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1550 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1551 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
|
1552 [super dealloc]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1553 } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1554 -(void)windowResized:(CGSize)size; |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1555 { |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1556 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
|
1557 { |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1558 _dw_do_resize(box, size.width, size.height); |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
1559 _dw_event_handler([self window], nil, _DW_EVENT_CONFIGURE); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1560 oldsize.width = size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1561 oldsize.height = size.height; |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1562 _dw_handle_resize_events(box); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1563 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1564 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1565 -(void)showWindow |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1566 { |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1567 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
|
1568 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1569 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
|
1570 { |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1571 _dw_do_resize(box, size.width, size.height); |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1572 _dw_handle_resize_events(box); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1573 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1574 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1575 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1576 -(void)windowDidBecomeMain:(id)sender |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1577 { |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
1578 _dw_event_handler([self window], nil, _DW_EVENT_SET_FOCUS); |
2372
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 -(void)menuHandler:(id)sender |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1581 { |
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
|
1582 [DWObj menuHandler:sender]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1583 } |
2598
4a5364fe65b7
iOS: Add some code to include DWViewController in the UIResponder chain.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2593
diff
changeset
|
1584 -(UIResponder *)nextResponder { return [[self window] rootViewController]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1585 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1586 |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1587 @interface DWViewController : UIViewController |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1588 -(void)viewWillLayoutSubviews; |
2598
4a5364fe65b7
iOS: Add some code to include DWViewController in the UIResponder chain.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2593
diff
changeset
|
1589 -(UIResponder *)nextResponder; |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1590 @end |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1591 |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1592 |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1593 @implementation DWViewController : UIViewController {} |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1594 -(void)viewWillLayoutSubviews |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1595 { |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1596 DWWindow *window = (DWWindow *)[[self view] window]; |
2599
32728f6f7ccd
iOS: Add UINavigationBar and DWView to the rootViewController's view.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2598
diff
changeset
|
1597 NSArray *array = [[self view] subviews]; |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
1598 CGRect frame = [window frame]; |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1599 DWView *view = nil; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1600 UINavigationBar *nav = nil; |
2570
2c2941e01b67
iOS: Slight refactoring to handle the possibility that the status bar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2569
diff
changeset
|
1601 NSInteger sbheight = [[[window windowScene] statusBarManager] statusBarFrame].size.height; |
2c2941e01b67
iOS: Slight refactoring to handle the possibility that the status bar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2569
diff
changeset
|
1602 |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1603 for(id obj in array) |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1604 { |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1605 if([obj isMemberOfClass:[DWView class]]) |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1606 view = obj; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1607 else if([obj isMemberOfClass:[UINavigationBar class]]) |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1608 nav = obj; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1609 } |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1610 /* Adjust the frame to account for the status bar and navigation bar if it exists */ |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1611 if(nav) |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1612 { |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1613 CGRect navrect = [nav frame]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1614 |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1615 navrect.size.width = frame.size.width; |
2570
2c2941e01b67
iOS: Slight refactoring to handle the possibility that the status bar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2569
diff
changeset
|
1616 navrect.origin.x = 0; |
2c2941e01b67
iOS: Slight refactoring to handle the possibility that the status bar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2569
diff
changeset
|
1617 navrect.origin.y = sbheight; |
2c2941e01b67
iOS: Slight refactoring to handle the possibility that the status bar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2569
diff
changeset
|
1618 sbheight += navrect.size.height; |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1619 [nav setFrame:navrect]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1620 |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1621 if (@available(iOS 14.0, *)) { |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1622 DWMenu *windowmenu = [window menu]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1623 UINavigationItem *item = [[nav items] firstObject]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1624 |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1625 if(windowmenu && !item.rightBarButtonItem) |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1626 { |
2600
0bb974e70435
iOS: Fix crash by retaining the UIMenu returned in the block.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2599
diff
changeset
|
1627 UIMenu *menu = [windowmenu menu]; |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1628 UIBarButtonItem *options = [[UIBarButtonItem alloc] initWithImage:[UIImage systemImageNamed:@"list.bullet"] |
2600
0bb974e70435
iOS: Fix crash by retaining the UIMenu returned in the block.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2599
diff
changeset
|
1629 menu:menu]; |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1630 item.rightBarButtonItem = options; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1631 } |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1632 } else { |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1633 // Fallback on earlier versions |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1634 } |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
1635 } |
2409
2ab3e88e5d68
iOS: Implement dw_notebook_page_set(). Fix statusbar offset location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2408
diff
changeset
|
1636 frame.size.height -= sbheight; |
2425
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
1637 /* Account for the special area on iPhone X and iPad Pro |
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
1638 * https://blog.maxrudberg.com/post/165590234593/ui-design-for-iphone-x-bottom-elements |
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
1639 */ |
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
1640 frame.size.height -= 24; |
2409
2ab3e88e5d68
iOS: Implement dw_notebook_page_set(). Fix statusbar offset location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2408
diff
changeset
|
1641 frame.origin.y += sbheight; |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
1642 [view setFrame:frame]; |
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
1643 [view windowResized:frame.size]; |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1644 } |
2598
4a5364fe65b7
iOS: Add some code to include DWViewController in the UIResponder chain.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2593
diff
changeset
|
1645 -(UIResponder *)nextResponder { return [[self viewIfLoaded] window]; } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1646 @end |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1647 |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1648 #define _DW_BUTTON_TYPE_NORMAL 0 |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1649 #define _DW_BUTTON_TYPE_CHECK 1 |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1650 #define _DW_BUTTON_TYPE_RADIO 2 |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1651 #define _DW_BUTTON_TYPE_TREE 3 |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1652 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1653 /* 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
|
1654 @interface DWButton : UIButton |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1655 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1656 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1657 DWBox *parent; |
2680
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1658 int type, checkstate; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1659 } |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1660 @property(nonatomic, strong) void(^didCheckedChanged)(BOOL checked); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1661 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1662 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1663 -(void)buttonClicked:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1664 -(void)setParent:(DWBox *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1665 -(DWBox *)parent; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1666 -(int)type; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1667 -(void)setType:(int)input; |
2698
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
1668 -(int)checkState; |
2680
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1669 -(void)setCheckState:(int)input; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1670 @end |
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 @implementation DWButton |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1673 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1674 -(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
|
1675 -(void)buttonClicked:(id)sender |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1676 { |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1677 /* Toggle the button */ |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1678 if(type == _DW_BUTTON_TYPE_CHECK || type == _DW_BUTTON_TYPE_TREE) |
2680
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1679 [self setCheckState:(checkstate ? FALSE : TRUE)]; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1680 else if(type == _DW_BUTTON_TYPE_RADIO) |
2680
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1681 [self setCheckState:TRUE]; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1682 |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
1683 _dw_event_handler(self, nil, _DW_EVENT_CLICKED); |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1684 |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1685 /* If it is a radio button, uncheck all the other radio buttons in the box */ |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1686 if(type == _DW_BUTTON_TYPE_RADIO) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1687 { |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1688 DWBox *viewbox = [self parent]; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1689 Box *thisbox = [viewbox box]; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1690 int z; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1691 |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1692 for(z=0;z<thisbox->count;z++) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1693 { |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
1694 if(thisbox->items[z].type != _DW_TYPE_BOX) |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1695 { |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1696 id object = thisbox->items[z].hwnd; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1697 |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1698 if([object isMemberOfClass:[DWButton class]]) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1699 { |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1700 DWButton *button = object; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1701 |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1702 if(button != self && [button type] == _DW_BUTTON_TYPE_RADIO) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1703 { |
2680
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1704 [button setCheckState:FALSE]; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1705 } |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1706 } |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1707 } |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1708 } |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1709 } |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1710 if(_didCheckedChanged) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1711 _didCheckedChanged(checkstate); |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1712 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1713 -(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
|
1714 -(DWBox *)parent { return parent; } |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1715 -(int)type { return type; } |
2680
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1716 -(void)setType:(int)input |
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1717 { |
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1718 type = input; |
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1719 if(type == _DW_BUTTON_TYPE_NORMAL) |
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1720 [self setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter]; |
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1721 else |
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1722 [self setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; |
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1723 [self updateImage]; |
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1724 } |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1725 -(void)updateImage |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1726 { |
2424
6b302a8c856f
iOS: Fix checked image not showing due to typo in image name.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2423
diff
changeset
|
1727 NSString *imagename = nil; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1728 |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1729 switch(type) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1730 { |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1731 case _DW_BUTTON_TYPE_CHECK: |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1732 { |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1733 |
2680
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1734 if(checkstate) |
2424
6b302a8c856f
iOS: Fix checked image not showing due to typo in image name.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2423
diff
changeset
|
1735 imagename = @"checkmark.square"; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1736 else |
2424
6b302a8c856f
iOS: Fix checked image not showing due to typo in image name.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2423
diff
changeset
|
1737 imagename = @"square"; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1738 } |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1739 break; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1740 case _DW_BUTTON_TYPE_RADIO: |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1741 { |
2680
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1742 if(checkstate) |
2424
6b302a8c856f
iOS: Fix checked image not showing due to typo in image name.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2423
diff
changeset
|
1743 imagename = @"largecircle.fill.circle"; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1744 else |
2424
6b302a8c856f
iOS: Fix checked image not showing due to typo in image name.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2423
diff
changeset
|
1745 imagename = @"circle"; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1746 } |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1747 break; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1748 case _DW_BUTTON_TYPE_TREE: |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1749 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1750 if(checkstate) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1751 imagename = @"chevron.down"; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1752 else |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1753 imagename = @"chevron.forward"; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1754 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
1755 break; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1756 } |
2424
6b302a8c856f
iOS: Fix checked image not showing due to typo in image name.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2423
diff
changeset
|
1757 if(imagename) |
6b302a8c856f
iOS: Fix checked image not showing due to typo in image name.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2423
diff
changeset
|
1758 { |
6b302a8c856f
iOS: Fix checked image not showing due to typo in image name.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2423
diff
changeset
|
1759 UIImage *image = [UIImage systemImageNamed:imagename]; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1760 CGSize size = [image size]; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1761 [self setImage:image forState:UIControlStateNormal]; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1762 [self setTitleEdgeInsets:UIEdgeInsetsMake(0,size.width,0,0)]; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1763 } |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
1764 } |
2680
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1765 -(int)checkState { return checkstate; } |
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
1766 -(void)setCheckState:(int)input { checkstate = input; [self updateImage]; } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1767 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1768 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1769 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1770 /* 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
|
1771 @interface DWPercent : UIProgressView |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1772 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1773 void *userdata; |
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 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1776 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1777 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1778 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1779 @implementation DWPercent |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1780 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1781 -(void)setUserdata:(void *)input { userdata = input; } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
1782 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1783 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1784 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1785 /* 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
|
1786 @implementation DWMenuItem |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1787 -(void)setCheck:(BOOL)input { check = input; } |
2601
3201f9e9067b
iOS: Actually implement disabled menu items using UIMenuElementAttributesDisabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2600
diff
changeset
|
1788 -(void)setEnabled:(BOOL)input { enabled = input; [self setAttributes:(enabled ? 0 : UIMenuElementAttributesDisabled)]; } |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1789 -(void)setSubmenu:(DWMenu *)input { submenu = input; } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1790 -(void)setMenu:(DWMenu *)input { menu = input; } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1791 -(void)setTag:(unsigned long)input { tag = input; } |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1792 -(BOOL)check { return check; } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1793 -(BOOL)enabled { return enabled; } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1794 -(DWMenu *)submenu { return submenu; } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1795 -(DWMenu *)menu { return menu; } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1796 -(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
|
1797 -(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
|
1798 @end |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1799 /* |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1800 * 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
|
1801 * 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
|
1802 * 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
|
1803 */ |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1804 @implementation DWMenu |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1805 -(id)initWithTag:(unsigned long)newtag |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1806 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1807 self = [super init]; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1808 if(self) |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1809 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1810 children = [[NSMutableArray alloc] init]; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1811 tag = newtag; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1812 } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1813 return self; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1814 } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1815 -(void)setTitle:(NSString *)input { title = input; [title retain]; } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1816 -(UIMenu *)menu |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1817 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1818 /* Create or recreate the UIMenu recursively */ |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1819 UIMenu *oldmenu = menu; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1820 NSMutableArray *menuchildren = [[NSMutableArray alloc] init]; |
2605
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1821 NSMutableArray *section = menuchildren; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1822 |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1823 for(id child in children) |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1824 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1825 if([child isMemberOfClass:[DWMenuItem class]]) |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1826 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1827 DWMenuItem *menuitem = child; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1828 DWMenu *submenu = [menuitem submenu]; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1829 |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1830 if(submenu) |
2605
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1831 [section addObject:[submenu menu]]; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1832 else |
2605
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1833 [section addObject:child]; |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1834 } |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1835 /* NSNull entry tells us to make a new section... |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1836 * we do this by making a new UIMenu inline. |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1837 */ |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1838 else if([child isMemberOfClass:[NSNull class]]) |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1839 { |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1840 if(section != menuchildren) |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1841 { |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1842 UIMenu *sectionmenu = [UIMenu menuWithTitle:@"" |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1843 image:nil |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1844 identifier:nil |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1845 options:UIMenuOptionsDisplayInline |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1846 children:section]; |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1847 [menuchildren addObject:sectionmenu]; |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1848 } |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1849 section = [[NSMutableArray alloc] init]; |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1850 } |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1851 } |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1852 if(section != menuchildren) |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1853 { |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1854 UIMenu *sectionmenu = [UIMenu menuWithTitle:@"" |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1855 image:nil |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1856 identifier:nil |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1857 options:UIMenuOptionsDisplayInline |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1858 children:section]; |
d60a44a27d70
iOS: Implement menu separators using inline UIMenus.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2604
diff
changeset
|
1859 [menuchildren addObject:sectionmenu]; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1860 } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1861 if(title) |
2603
592f3003f853
iOS: Switch to using UIKeyCommand for menu items so we can use they keyboard
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2602
diff
changeset
|
1862 { |
592f3003f853
iOS: Switch to using UIKeyCommand for menu items so we can use they keyboard
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2602
diff
changeset
|
1863 menu = [UIMenu menuWithTitle:title image:[UIImage systemImageNamed:@"ellipsis"] identifier:nil |
592f3003f853
iOS: Switch to using UIKeyCommand for menu items so we can use they keyboard
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2602
diff
changeset
|
1864 options:0 children:menuchildren]; |
592f3003f853
iOS: Switch to using UIKeyCommand for menu items so we can use they keyboard
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2602
diff
changeset
|
1865 } |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1866 else |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1867 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1868 if(@available(iOS 14.0, *)) |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1869 menu = [UIMenu menuWithChildren:menuchildren]; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1870 else |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1871 menu = [UIMenu menuWithTitle:@"" children:menuchildren]; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1872 } |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
1873 [menu retain]; |
2817
5000a8a43825
iOS: Fix some memory leaks and remove unnecessary code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2813
diff
changeset
|
1874 [menuchildren release]; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1875 if(oldmenu) |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1876 [oldmenu release]; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1877 return menu; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1878 } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1879 -(void)addItem:(id)item |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1880 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1881 [children addObject:item]; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1882 } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1883 -(void)removeItem:(id)item |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1884 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1885 [children removeObject:item]; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1886 } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1887 -(unsigned long)tag { return tag; } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1888 -(id)childWithTag:(unsigned long)tag |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1889 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1890 if(tag > 0) |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1891 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1892 for(id child in children) |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1893 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1894 if([child isMemberOfClass:[DWMenuItem class]] && [child tag] == tag) |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1895 return child; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
1896 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1897 } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1898 return nil; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1899 } |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
1900 -(void)dealloc |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
1901 { |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
1902 if(menu) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
1903 [menu release]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
1904 [super dealloc]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
1905 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1906 @end |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1907 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1908 @implementation DWImage |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1909 -(id)initWithSize:(CGSize)size |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1910 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1911 self = [super init]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1912 if(self) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1913 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1914 CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
1915 CGContextRef cgcontext = CGBitmapContextCreate(NULL, size.width, size.height, 8, 0, rgb, kCGImageAlphaPremultipliedFirst); |
2438
f273dbf1312f
iOS: Fix DWImage internal core graphics context being flipped.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2437
diff
changeset
|
1916 CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, size.height); |
f273dbf1312f
iOS: Fix DWImage internal core graphics context being flipped.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2437
diff
changeset
|
1917 CGContextConcatCTM(cgcontext, flipVertical); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1918 CGImageRef cgimage = CGBitmapContextCreateImage(cgcontext); |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1919 image = [UIImage imageWithCGImage:cgimage]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1920 CGContextRelease(cgcontext); |
2437
929ce3cd18ea
iOS: Fix bitblt and crashes due to missing retains.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2436
diff
changeset
|
1921 [image retain]; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1922 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1923 return self; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1924 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1925 -(id)initWithCGImage:(CGImageRef)cgimage |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1926 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1927 self = [super init]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1928 if(self) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1929 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1930 image = [UIImage imageWithCGImage:cgimage]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1931 [image retain]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1932 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1933 return self; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1934 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1935 -(id)initWithUIImage:(UIImage *)newimage |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1936 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1937 self = [super init]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1938 if(self) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1939 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1940 image = newimage; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1941 [image retain]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1942 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1943 return self; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1944 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1945 -(void)setImage:(UIImage *)input |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1946 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1947 UIImage *oldimage = image; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1948 image = input; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1949 [image retain]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1950 [oldimage release]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1951 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1952 -(UIImage *)image |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1953 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1954 /* If our CGContext has been modified... */ |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1955 if(cgcontext) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1956 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1957 UIImage *oldimage = image; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1958 CGImageRef cgimage; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1959 |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1960 /* Create a new UIImage from the CGContext via CGImage */ |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1961 cgimage = CGBitmapContextCreateImage(cgcontext); |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1962 image = [UIImage imageWithCGImage:cgimage]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1963 CGContextRelease(cgcontext); |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1964 cgcontext = nil; |
2437
929ce3cd18ea
iOS: Fix bitblt and crashes due to missing retains.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2436
diff
changeset
|
1965 [image retain]; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1966 [oldimage release]; |
2737
74b69da35e91
iOS: Fix a pixmap memory leak, CGImage needs to be released after using it
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2729
diff
changeset
|
1967 CGImageRelease(cgimage); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1968 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1969 return image; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1970 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1971 -(CGContextRef)cgcontext |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1972 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1973 /* If we don't have an active context, create a bitmap |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1974 * context and copy the image from our UIImage. |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1975 */ |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1976 if(!cgcontext) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1977 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1978 CGSize size = [image size]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1979 CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1980 |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
1981 cgcontext = CGBitmapContextCreate(NULL, size.width, size.height, 8, 0, rgb, kCGImageAlphaPremultipliedFirst); |
2438
f273dbf1312f
iOS: Fix DWImage internal core graphics context being flipped.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2437
diff
changeset
|
1982 CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, size.height); |
f273dbf1312f
iOS: Fix DWImage internal core graphics context being flipped.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2437
diff
changeset
|
1983 CGContextConcatCTM(cgcontext, flipVertical); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1984 CGContextDrawImage(cgcontext, CGRectMake(0,0,size.width,size.height), [image CGImage]); |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1985 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1986 return cgcontext; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1987 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
1988 -(void)dealloc { if(cgcontext) CGContextRelease(cgcontext); if(image) [image release]; [super dealloc]; } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1989 @end |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1990 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1991 /* 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
|
1992 @interface DWScrollBox : UIScrollView |
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; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1995 id box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1996 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1997 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1998 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1999 -(void)setBox:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2000 -(id)box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2001 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2002 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2003 @implementation DWScrollBox |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2004 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2005 -(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
|
2006 -(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
|
2007 -(id)box { return box; } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2008 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2009 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2010 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2011 /* Subclass for a entryfield type */ |
2704
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2012 @interface DWEntryField : UITextField <UITextFieldDelegate> |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2013 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2014 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2015 id clickDefault; |
2704
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2016 unsigned long limit; |
2372
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 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2019 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2020 -(void)setClickDefault:(id)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2021 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2022 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2023 @implementation DWEntryField |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2024 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2025 -(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
|
2026 -(void)setClickDefault:(id)input { clickDefault = input; } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2027 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2704
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2028 -(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2029 { |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2030 // Prevent crashing undo bug – see note below. |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2031 if(range.length + range.location > textField.text.length) |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2032 return NO; |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2033 |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2034 if(limit > 0) |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2035 { |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2036 NSUInteger newLength = [textField.text length] + [string length] - range.length; |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2037 return newLength <= limit; |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2038 } |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2039 return YES; |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2040 } |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2041 -(void)setMaximumLength:(unsigned long)length { limit = length; } |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
2042 -(unsigned long)maximumLength { return limit; } |
2372
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 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
|
2046 @interface DWText : UILabel |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2047 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2048 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2049 id clickDefault; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2050 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2051 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2052 -(void)setUserdata:(void *)input; |
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 @implementation DWText |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2056 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2057 -(void)setUserdata:(void *)input { userdata = input; } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2058 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2059 @end |
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 /* Subclass for a Notebook page type */ |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2062 @interface DWNotebookPage : DWBox |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2063 { |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2064 int pageid; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2065 } |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2066 -(int)pageid; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2067 -(void)setPageid:(int)input; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2068 @end |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2069 |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2070 /* Subclass for a Notebook control type */ |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2071 @interface DWNotebook : UIView |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2072 { |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2073 UISegmentedControl *tabs; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2074 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2075 int pageid; |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2076 NSMutableArray<DWNotebookPage *> *views; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2077 DWNotebookPage *visible; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2078 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2079 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2080 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2081 -(int)pageid; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2082 -(void)setPageid:(int)input; |
2420
384d076ed52a
iOS: Minor fix for initial notebook page remaining visible on page change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2419
diff
changeset
|
2083 -(void)setVisible:(DWNotebookPage *)input; |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2084 -(UISegmentedControl *)tabs; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
2085 -(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
|
2086 -(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
|
2087 @end |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
2088 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2089 @implementation DWNotebook |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2090 -(id)init { |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2091 self = [super init]; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2092 tabs = [[[UISegmentedControl alloc] init] retain]; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2093 views = [[[NSMutableArray alloc] init] retain]; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2094 [self addSubview:tabs]; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2095 return self; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2096 } |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2097 -(void)setFrame:(CGRect)frame { |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2098 [super setFrame:frame]; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2099 frame.size.height = 40; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2100 [tabs setFrame:frame]; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2101 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2102 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2103 -(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
|
2104 -(int)pageid { return pageid; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2105 -(void)setPageid:(int)input { pageid = input; } |
2420
384d076ed52a
iOS: Minor fix for initial notebook page remaining visible on page change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2419
diff
changeset
|
2106 -(void)setVisible:(DWNotebookPage *)input { visible = input; } |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2107 -(UISegmentedControl *)tabs { return tabs; } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
2108 -(NSMutableArray<DWNotebookPage *> *)views { return views; }; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2109 -(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
|
2110 { |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2111 NSInteger intpageid = [tabs selectedSegmentIndex]; |
2413
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2112 |
2419
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
2113 if(intpageid != -1 && intpageid < [views count]) |
2413
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2114 { |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2115 DWNotebookPage *page = [views objectAtIndex:intpageid]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2116 |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2117 /* Hide the previously visible page contents */ |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2118 if(page != visible) |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2119 [visible setHidden:YES]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2120 |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2121 /* If the new page is a valid box, lay it out */ |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2122 if([page isKindOfClass:[DWBox class]]) |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2123 { |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2124 Box *box = [page box]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2125 /* Start with the entire notebook size and then adjust |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2126 * it to account for the segement control's height. |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2127 */ |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2128 NSInteger height = [tabs frame].size.height; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2129 CGRect frame = [self frame]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2130 frame.origin.y += height; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2131 frame.size.height -= height; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2132 [page setFrame:frame]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2133 [page setHidden:NO]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2134 visible = page; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2135 _dw_do_resize(box, frame.size.width, frame.size.height); |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2136 _dw_handle_resize_events(box); |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
2137 } |
2693
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
2138 _dw_event_handler(self, DW_INT_TO_POINTER([page pageid]), _DW_EVENT_SWITCH_PAGE); |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
2139 } |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
2140 else |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
2141 visible = nil; |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2142 } |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2143 -(void)dealloc { |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2144 UserData *root = userdata; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2145 _dw_remove_userdata(&root, NULL, TRUE); |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2146 dw_signal_disconnect_by_window(self); |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2147 [tabs release]; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2148 [views release]; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2149 [super dealloc]; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
2150 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2151 @end |
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 @implementation DWNotebookPage |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2154 -(int)pageid { return pageid; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2155 -(void)setPageid:(int)input { pageid = input; } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2156 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2157 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2158 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2159 /* Subclass for a splitbar type */ |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2160 @interface DWSplitBar : UIView |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2161 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2162 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2163 float percent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2164 NSInteger Tag; |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2165 id topleft; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2166 id bottomright; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2167 int splittype; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2168 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2169 -(void)setTag:(NSInteger)tag; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2170 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2171 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2172 -(float)percent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2173 -(void)setPercent:(float)input; |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2174 -(id)topLeft; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2175 -(void)setTopLeft:(id)input; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2176 -(id)bottomRight; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2177 -(void)setBottomRight:(id)input; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2178 -(int)type; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2179 -(void)setType:(int)input; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2180 -(void)resize; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2181 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2182 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2183 @implementation DWSplitBar |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2184 -(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
|
2185 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2186 -(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
|
2187 -(float)percent { return percent; } |
2647
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2188 -(void)setPercent:(float)input |
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2189 { |
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2190 percent = input; |
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2191 if(percent > 100.0) |
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2192 percent = 100.0; |
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2193 else if(percent < 0.0) |
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2194 percent = 0.0; |
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2195 [self resize]; |
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2196 } |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2197 -(id)topLeft { return topleft; } |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2198 -(void)setTopLeft:(id)input |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2199 { |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2200 topleft = input; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2201 [self addSubview:topleft]; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2202 [topleft autorelease]; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2203 } |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2204 -(id)bottomRight { return bottomright; } |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2205 -(void)setBottomRight:(id)input |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2206 { |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2207 bottomright = input; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2208 [self addSubview:bottomright]; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2209 [bottomright autorelease]; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2210 |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2211 } |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2212 -(int)type { return splittype; } |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2213 -(void)setType:(int)input { splittype = input; } |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2214 -(void)resize |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2215 { |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2216 CGRect rect = self.frame; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2217 CGRect half = rect; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2218 |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2219 half.origin.x = half.origin.y = 0; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2220 |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2221 if(splittype == DW_HORZ) |
2647
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2222 half.size.width = (percent/100.0) * rect.size.width; |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2223 else |
2647
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2224 half.size.height = (percent/100.0) * rect.size.height; |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2225 if(topleft) |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2226 { |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2227 DWBox *view = topleft; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2228 Box *box = [view box]; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2229 [topleft setFrame:half]; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2230 _dw_do_resize(box, half.size.width, half.size.height); |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2231 _dw_handle_resize_events(box); |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2232 } |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2233 if(splittype == DW_HORZ) |
2647
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2234 { |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2235 half.origin.x = half.size.width; |
2647
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2236 half.size.width = rect.size.width - half.size.width; |
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2237 } |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2238 else |
2647
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2239 { |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2240 half.origin.y = half.size.height; |
2647
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2241 half.size.height = rect.size.height - half.size.height; |
34c4cb84834a
iOS: Fix a miscalculation during DWSplitBar resize.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2646
diff
changeset
|
2242 } |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2243 if(bottomright) |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2244 { |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2245 DWBox *view = bottomright; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2246 Box *box = [view box]; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2247 [bottomright setFrame:half]; |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2248 _dw_do_resize(box, half.size.width, half.size.height); |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2249 _dw_handle_resize_events(box); |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2250 } |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
2251 } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2252 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2253 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2254 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2255 /* 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
|
2256 @interface DWSlider : UISlider |
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 void *userdata; |
2540
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2259 BOOL vertical; |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2260 } |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2261 -(void)setVertical:(BOOL)vert; |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2262 -(BOOL)vertical; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2263 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2264 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2265 -(void)sliderChanged:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2266 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2267 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2268 @implementation DWSlider |
2540
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2269 -(void)setVertical:(BOOL)vert |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2270 { |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2271 if(vert) |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2272 { |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2273 CGAffineTransform trans = CGAffineTransformMakeRotation(M_PI * 0.5); |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2274 self.transform = trans; |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2275 } |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2276 vertical = vert; |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2277 } |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
2278 -(BOOL)vertical { return vertical; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2279 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2280 -(void)setUserdata:(void *)input { userdata = input; } |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
2281 -(void)sliderChanged:(id)sender { int intVal = (int)[self value]; _dw_event_handler(self, DW_INT_TO_POINTER(intVal), _DW_EVENT_VALUE_CHANGED); } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2282 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2283 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2284 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2285 /* 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
|
2286 @interface DWMLE : UITextView |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2287 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2288 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2289 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2290 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2291 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2292 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2293 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2294 @implementation DWMLE |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2295 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2296 -(void)setUserdata:(void *)input { userdata = input; } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2297 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2298 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2299 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
2300 /* 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
|
2301 * 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
|
2302 */ |
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
|
2303 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
|
2304 { |
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
|
2305 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
|
2306 [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
|
2307 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2308 if(icon) |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
2309 [[browsercell imageView] setImage:icon]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2310 if(text) |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
2311 [[browsercell textLabel] setText:text]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2312 return browsercell; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2313 } |
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 /* 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
|
2316 @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
|
2317 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2318 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2319 NSMutableArray *tvcols; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2320 NSMutableArray *data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2321 NSMutableArray *types; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2322 NSPointerArray *titles; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2323 NSPointerArray *rowdatas; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2324 UIColor *fgcolor, *oddcolor, *evencolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2325 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
|
2326 unsigned long _DW_COLOR_ROW_ODD, _DW_COLOR_ROW_EVEN; |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2327 int iLastAddPoint, iLastQueryPoint; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2328 int filesystem; |
2612
4628c8c34125
iOS: Standardize DWContainer behavior part 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2610
diff
changeset
|
2329 NSTimeInterval lastClick; |
4628c8c34125
iOS: Standardize DWContainer behavior part 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2610
diff
changeset
|
2330 NSInteger lastClickRow; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2331 } |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2332 -(NSInteger)tableView:(UITableView *)aTable numberOfRowsInSection:(NSInteger)section; |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2333 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2334 -(void)tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2335 -(UIContextMenuConfiguration *)tableView:(UITableView *)tableView contextMenuConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath point:(CGPoint)point; |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2336 -(void)addColumn:(NSString *)input andType:(int)type; |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2337 -(NSString *)getColumn:(int)col; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2338 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2339 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2340 -(void)setFilesystem:(int)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2341 -(int)filesystem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2342 -(int)addRow:(NSArray *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2343 -(int)addRows:(int)number; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2344 -(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
|
2345 -(void)removeRow:(int)row; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2346 -(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
|
2347 -(void *)getRowTitle:(int)row; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2348 -(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
|
2349 -(int)cellType:(int)col; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2350 -(int)lastAddPoint; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2351 -(int)lastQueryPoint; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2352 -(void)setLastQueryPoint:(int)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2353 -(void)clear; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2354 -(void)setup; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
2355 -(CGSize)getsize; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2356 -(void)setForegroundColor:(UIColor *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2357 @end |
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 @implementation DWContainer |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2360 -(NSInteger)tableView:(UITableView *)aTable numberOfRowsInSection:(NSInteger)section |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2361 { |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2362 /* Ignoring section for now, everything in one section */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2363 if(tvcols && data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2364 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2365 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
|
2366 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
|
2367 if(cols && total) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2368 return total / cols; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2369 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2370 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2371 } |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2372 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2373 { |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2374 /* Not reusing cell views, so get the cell from our array */ |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2375 int index = (int)(indexPath.row * [tvcols count]); |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2376 id celldata = [data objectAtIndex:index]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2377 |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2378 /* 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
|
2379 if([celldata isMemberOfClass:[UITableViewCell class]]) |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2380 { |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2381 UITableViewCell *result = celldata; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2382 |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2383 /* 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
|
2384 * 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
|
2385 */ |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
2386 if(fgcolor) |
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
2387 [[result textLabel] setTextColor:fgcolor]; |
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
2388 |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2389 /* Return the result */ |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2390 return result; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2391 } |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2392 return nil; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2393 } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2394 -(void)tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2395 { |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2396 if(indexPath.row % 2 == 0) |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2397 { |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2398 if(evencolor) |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2399 [cell setBackgroundColor:evencolor]; |
2678
24fb27a1e039
iOS: Make UITableViewCell backgrounds clear if not set explicitly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2674
diff
changeset
|
2400 else |
24fb27a1e039
iOS: Make UITableViewCell backgrounds clear if not set explicitly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2674
diff
changeset
|
2401 [cell setBackgroundColor:[UIColor clearColor]]; |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2402 } |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2403 else |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2404 { |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2405 if(oddcolor) |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2406 [cell setBackgroundColor:oddcolor]; |
2678
24fb27a1e039
iOS: Make UITableViewCell backgrounds clear if not set explicitly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2674
diff
changeset
|
2407 else |
24fb27a1e039
iOS: Make UITableViewCell backgrounds clear if not set explicitly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2674
diff
changeset
|
2408 [cell setBackgroundColor:[UIColor clearColor]]; |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2409 } |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2410 } |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2411 -(UIContextMenuConfiguration *)tableView:(UITableView *)tableView contextMenuConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath point:(CGPoint)point |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2412 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2413 DWWindow *window = (DWWindow *)[self window]; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2414 UIContextMenuConfiguration *config = nil; |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2415 NSPointerArray *params = [NSPointerArray pointerArrayWithOptions:NSPointerFunctionsOpaqueMemory]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2416 |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2417 [params addPointer:[self getRowTitle:(int)indexPath.row]]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2418 [params addPointer:[self getRowData:(int)indexPath.row]]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2419 [params addPointer:DW_INT_TO_POINTER((int)point.x)]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2420 [params addPointer:DW_INT_TO_POINTER((int)point.y)]; |
2467
4d1f370bf65e
iOS: Pass in the coordinates and row data on container context event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2464
diff
changeset
|
2421 |
2606
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
2422 _dw_event_point = point; |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2423 _dw_event_handler(self, params, _DW_EVENT_ITEM_CONTEXT); |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2424 |
2602
cc5013e626f7
iOS: Code cleanup, make sure menu items are enabled on creation.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2601
diff
changeset
|
2425 if(window && [window popupMenu]) |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2426 { |
2600
0bb974e70435
iOS: Fix crash by retaining the UIMenu returned in the block.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2599
diff
changeset
|
2427 __block UIMenu *popupmenu = [[[window popupMenu] menu] retain]; |
0bb974e70435
iOS: Fix crash by retaining the UIMenu returned in the block.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2599
diff
changeset
|
2428 config = [UIContextMenuConfiguration configurationWithIdentifier:nil |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2429 previewProvider:nil |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2430 actionProvider:^(NSArray* suggestedAction){return popupmenu;}]; |
2464
4fba0b9453ee
iOS: Fix calculating label size when there is no text. Use "gT" to calculate
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2463
diff
changeset
|
2431 [window setPopupMenu:nil]; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2432 } |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2433 return config; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
2434 } |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2435 -(void)addColumn:(NSString *)input andType:(int)type { if(tvcols) { [tvcols addObject:input]; [types addObject:[NSNumber numberWithInt:type]]; } } |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2436 -(NSString *)getColumn:(int)col { if(tvcols) { return [tvcols objectAtIndex:col]; } return nil; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2437 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2438 -(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
|
2439 -(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
|
2440 -(int)filesystem { return filesystem; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2441 -(void)refreshColors |
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 UIColor *oldodd = oddcolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2444 UIColor *oldeven = evencolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2445 unsigned long thisodd = dw_oddcolor == DW_CLR_DEFAULT ? _DW_COLOR_ROW_ODD : dw_oddcolor; |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2446 unsigned long _odd = _dw_get_color(thisodd); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2447 unsigned long thiseven = dw_evencolor == DW_CLR_DEFAULT ? _DW_COLOR_ROW_EVEN : dw_evencolor; |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2448 unsigned long _even = _dw_get_color(thiseven); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2449 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2450 /* 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
|
2451 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
|
2452 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
|
2453 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2454 oddcolor = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2455 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
|
2456 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
|
2457 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2458 evencolor = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2459 [oldodd release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2460 [oldeven release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2461 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2462 -(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
|
2463 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2464 /* 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
|
2465 dw_oddcolor = oddcol; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2466 dw_evencolor = evencol; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2467 [self refreshColors]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2468 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2469 -(void)checkDark |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2470 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2471 /* 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
|
2472 _DW_COLOR_ROW_EVEN = DW_RGB_TRANSPARENT; |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
2473 if(_dw_is_dark()) |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
2474 _DW_COLOR_ROW_ODD = DW_RGB(100, 100, 100); |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
2475 else |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
2476 _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
|
2477 /* 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
|
2478 if(titles) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2479 [self refreshColors]; |
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 -(void)viewDidChangeEffectiveAppearance { [self checkDark]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2482 -(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
|
2483 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2484 if(data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2485 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2486 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
|
2487 NSIndexSet *set = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(start, start + [tvcols count])]; |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2488 if(index < iLastAddPoint) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2489 { |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2490 iLastAddPoint++; |
2372
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 [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
|
2493 [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
|
2494 [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
|
2495 [set release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2496 return (int)[titles count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2497 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2498 return 0; |
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 -(int)addRow:(NSArray *)input |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2501 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2502 if(data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2503 { |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2504 iLastAddPoint = (int)[titles count]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2505 [data addObjectsFromArray:input]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2506 [titles addPointer:NULL]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2507 [rowdatas addPointer:NULL]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2508 return (int)[titles count]; |
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 return 0; |
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 -(int)addRows:(int)number |
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(tvcols) |
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 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
|
2517 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2518 |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2519 iLastAddPoint = (int)[titles count]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2520 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2521 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
|
2522 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2523 [data addObject:[NSNull null]]; |
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 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
|
2526 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2527 [titles addPointer:NULL]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2528 [rowdatas addPointer:NULL]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2529 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2530 return (int)[titles count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2531 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2532 return 0; |
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 -(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
|
2535 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2536 if(tvcols) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2537 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2538 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
|
2539 if(index < [data count]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2540 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2541 if(!input) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2542 input = [NSNull null]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2543 [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
|
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 -(void)removeRow:(int)row |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2548 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2549 if(tvcols) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2550 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2551 int z, start, end; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2552 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
|
2553 void *oldtitle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2554 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2555 start = (count * row); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2556 end = start + count; |
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 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
|
2559 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2560 [data removeObjectAtIndex:start]; |
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 oldtitle = [titles pointerAtIndex:row]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2563 [titles removePointerAtIndex:row]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2564 [rowdatas removePointerAtIndex:row]; |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2565 if(iLastAddPoint > 0 && iLastAddPoint > row) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2566 { |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2567 iLastAddPoint--; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2568 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2569 if(oldtitle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2570 free(oldtitle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2571 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2572 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2573 -(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
|
2574 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2575 if(titles && input) |
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 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
|
2578 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
|
2579 [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
|
2580 if(oldtitle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2581 free(oldtitle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2582 } |
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 -(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
|
2585 -(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
|
2586 -(void *)getRowData:(int)row { if(rowdatas && row > -1) { return [rowdatas pointerAtIndex:row]; } return NULL; } |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
2587 -(id)getRow:(int)row and:(int)col { if(data && [data count]) { int index = (int)(row * [tvcols count]) + col; return [data objectAtIndex:index]; } return nil; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2588 -(int)cellType:(int)col { return [[types objectAtIndex:col] intValue]; } |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2589 -(int)lastAddPoint { return iLastAddPoint; } |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2590 -(int)lastQueryPoint { return iLastQueryPoint; } |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2591 -(void)setLastQueryPoint:(int)input { iLastQueryPoint = input; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2592 -(void)clear |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2593 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2594 if(data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2595 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2596 [data removeAllObjects]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2597 while([titles count]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2598 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2599 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
|
2600 [titles removePointerAtIndex:0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2601 [rowdatas removePointerAtIndex:0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2602 if(oldtitle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2603 free(oldtitle); |
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 } |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
2606 iLastAddPoint = 0; |
2372
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 -(void)setup |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2609 { |
2389
7b06fc7c8130
iOS: Remove some legacy code from macOS 10.5 by swithing to using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2388
diff
changeset
|
2610 titles = [[NSPointerArray pointerArrayWithOptions:NSPointerFunctionsOpaqueMemory] retain]; |
7b06fc7c8130
iOS: Remove some legacy code from macOS 10.5 by swithing to using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2388
diff
changeset
|
2611 rowdatas = [[NSPointerArray pointerArrayWithOptions:NSPointerFunctionsOpaqueMemory] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2612 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
|
2613 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
|
2614 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
|
2615 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
|
2616 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
|
2617 [self checkDark]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2618 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
2619 -(CGSize)getsize |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2620 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2621 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
|
2622 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2623 if(tvcols) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2624 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2625 int colcount = (int)[tvcols count]; |
2388
d84cd4227b21
iOS: Switch to UITableViewDataSource method numberOfRowsInSection:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2387
diff
changeset
|
2626 int rowcount = (int)[self numberOfRowsInSection:0]; |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2627 int width = 0; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2628 |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2629 if(rowcount > 0) |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2630 { |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2631 int x; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2632 |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2633 for(x=0;x<rowcount;x++) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2634 { |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2635 UITableViewCell *cell = [data objectAtIndex:(x*colcount)]; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2636 int thiswidth = 4, thisheight = 0; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2637 |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2638 if([cell imageView]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2639 { |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2640 thiswidth += [[cell imageView] image].size.width; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2641 thisheight = [[cell imageView] image].size.height; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2642 } |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2643 if([cell textLabel]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2644 { |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2645 int textheight = [[cell textLabel] intrinsicContentSize].width; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2646 thiswidth += [[cell textLabel] intrinsicContentSize].width; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2647 if(textheight > thisheight) |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2648 thisheight = textheight; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2649 } |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2650 |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2651 cheight += thisheight; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2652 |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2653 if(thiswidth > width) |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2654 { |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2655 width = thiswidth; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2656 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2657 } |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2658 /* If the image is missing default the optimized width to 16. */ |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2659 if(!width && [[types objectAtIndex:0] intValue] & DW_CFA_BITMAPORICON) |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2660 { |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2661 width = 16; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2662 } |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2663 } |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2664 if(width) |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2665 cwidth += width; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2666 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2667 cwidth += 16; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2668 cheight += 16; |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
2669 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
|
2670 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2671 -(void)setForegroundColor:(UIColor *)input |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2672 { |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2673 UIColor *oldfgcolor = fgcolor; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2674 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2675 fgcolor = input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2676 [fgcolor retain]; |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2677 [oldfgcolor release]; |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2678 } |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2679 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2680 { |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2681 NSPointerArray *params = [NSPointerArray pointerArrayWithOptions:NSPointerFunctionsOpaqueMemory]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2682 |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2683 [params addPointer:[self getRowTitle:(int)indexPath.row]]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2684 [params addPointer:[self getRowData:(int)indexPath.row]]; |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2685 |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2686 /* If multiple selection is enabled, treat it as selectionChanged: */ |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2687 if([self allowsMultipleSelection]) |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2688 { |
2612
4628c8c34125
iOS: Standardize DWContainer behavior part 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2610
diff
changeset
|
2689 NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate]; |
4628c8c34125
iOS: Standardize DWContainer behavior part 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2610
diff
changeset
|
2690 |
4628c8c34125
iOS: Standardize DWContainer behavior part 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2610
diff
changeset
|
2691 /* Handler for container class... check for double tap */ |
4628c8c34125
iOS: Standardize DWContainer behavior part 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2610
diff
changeset
|
2692 if(lastClickRow == indexPath.row && now - lastClick < 0.3) |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2693 _dw_event_handler(self, params, _DW_EVENT_ITEM_ENTER); |
2612
4628c8c34125
iOS: Standardize DWContainer behavior part 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2610
diff
changeset
|
2694 else |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2695 _dw_event_handler(self, params, _DW_EVENT_ITEM_SELECT); |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2696 /* Handler for listbox class */ |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
2697 _dw_event_handler(self, DW_INT_TO_POINTER((int)indexPath.row), _DW_EVENT_LIST_SELECT); |
2612
4628c8c34125
iOS: Standardize DWContainer behavior part 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2610
diff
changeset
|
2698 /* Update lastClick for double tap check */ |
4628c8c34125
iOS: Standardize DWContainer behavior part 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2610
diff
changeset
|
2699 lastClick = now; |
4628c8c34125
iOS: Standardize DWContainer behavior part 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2610
diff
changeset
|
2700 lastClickRow = indexPath.row; |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2701 } |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2702 else /* Otherwise treat it as doubleClicked: */ |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2703 { |
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2704 /* Handler for container class */ |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2705 _dw_event_handler(self, params, _DW_EVENT_ITEM_ENTER); |
2426
6220f0580088
iOS: DWContainer attempt to get touch and selection handlers working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2425
diff
changeset
|
2706 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2707 } |
2458
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
2708 -(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
2709 { |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
2710 if([self allowsMultipleSelection]) |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
2711 [self tableView:tableView didSelectRowAtIndexPath:indexPath]; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
2712 } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
2713 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2714 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2715 |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2716 /* Custom tree view subclasses: DWTree, DWTreeItem, DWTreeViewCell, DWTreeViewCellDelegate */ |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2717 @interface DWTreeItem : NSObject |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2718 @property(nonatomic, strong) UIImage *icon; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2719 @property(nonatomic, strong) NSString *title; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2720 @property(nonatomic, assign) void *data; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2721 @property(nonatomic, weak) DWTreeItem *parent; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2722 @property(nonatomic, retain, readonly) NSMutableArray<DWTreeItem *> *children; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2723 @property(nonatomic, assign, readonly) NSUInteger levelDepth; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2724 @property(nonatomic, assign, readonly) BOOL isRoot; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2725 @property(nonatomic, assign, readonly) BOOL hasChildren; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2726 @property(nonatomic, assign) BOOL expanded; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2727 -(instancetype)initWithIcon:(UIImage *)icon Title:(NSString *)title andData:(void *)itemdata; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2728 -(void)insertChildAfter:(DWTreeItem *)treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2729 -(void)appendChild:(DWTreeItem *)newChild; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2730 -(void)removeFromParent; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2731 -(void)moveToDestination:(DWTreeItem *)destination; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2732 -(BOOL)containsTreeItem:(DWTreeItem *)treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2733 -(NSArray<DWTreeItem *> *)visibleNodes; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2734 @end |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2735 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2736 @implementation DWTreeItem |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2737 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2738 NSArray *_flattenedTreeCache; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2739 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2740 -(void)dealloc { NSLog(@"DWTreeItem \"%@\" dealloc", self.title); [_title release]; [_icon release]; [super dealloc]; } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2741 -(instancetype)initWithIcon:(UIImage *)icon Title:(NSString *)title andData:(void *)itemdata |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2742 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2743 if(self = [super init]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2744 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2745 _title = [title retain]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2746 _icon = [icon retain]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2747 _data = itemdata; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2748 _children = [[NSMutableArray alloc] initWithCapacity:1]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2749 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2750 return self; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2751 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2752 -(NSString *)title |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2753 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2754 if(_title) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2755 return _title; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2756 return self.description; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2757 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2758 -(UIImage *)icon |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2759 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2760 if(_icon) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2761 return _icon; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2762 return nil; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2763 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2764 -(NSArray<DWTreeItem *> *)visibleNodes |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2765 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2766 NSMutableArray *allElements = [[NSMutableArray alloc] init]; |
2766
9b9bc2c2bbad
iOS: Skip displaying the root node, it just represents the tree itself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2765
diff
changeset
|
2767 if(![self isRoot]) |
9b9bc2c2bbad
iOS: Skip displaying the root node, it just represents the tree itself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2765
diff
changeset
|
2768 [allElements addObject:self]; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2769 if(_expanded) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2770 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2771 for (DWTreeItem *child in _children) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2772 [allElements addObjectsFromArray:[child visibleNodes]]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2773 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2774 return allElements; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2775 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2776 -(void)insertChildAfter:(DWTreeItem *)treeItem |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2777 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2778 DWTreeItem *parent = self.parent; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2779 NSUInteger index = [parent.children indexOfObject:self]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2780 if(index == NSNotFound) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2781 index = [parent.children count]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2782 treeItem.parent = parent; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2783 [parent.children insertObject:treeItem atIndex:(index+1)]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2784 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2785 -(void)appendChild:(DWTreeItem *)newChild |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2786 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2787 newChild.parent = self; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2788 [_children addObject:newChild]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2789 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2790 -(void)removeFromParent |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2791 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2792 DWTreeItem *parent = self.parent; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2793 if(parent) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2794 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2795 [parent.children removeObject:self]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2796 self.parent = nil; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2797 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2798 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2799 -(void)moveToDestination:(DWTreeItem *)destination |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2800 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2801 NSAssert([self containsTreeItem:destination]==NO, @"[self containsTreeItem:destination] something went wrong!"); |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2802 if(self == destination || destination == nil) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2803 return; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2804 [self removeFromParent]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2805 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2806 [destination insertChildAfter:self]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2807 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2808 -(BOOL)containsTreeItem:(DWTreeItem *)treeItem |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2809 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2810 DWTreeItem *parent = treeItem.parent; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2811 if(parent == nil) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2812 return NO; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2813 if(self == parent) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2814 return YES; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2815 return [self containsTreeItem:parent]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2816 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2817 -(NSUInteger)levelDepth |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2818 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2819 NSUInteger cnt = 0; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2820 if(_parent != nil) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2821 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2822 cnt += 1; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2823 cnt += [_parent levelDepth]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2824 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2825 return cnt; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2826 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2827 -(BOOL)isRoot { return (!_parent); } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2828 -(BOOL)hasChildren { return (_children.count > 0); } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2829 @end |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2830 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2831 @class DWTreeViewCell; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2832 @protocol DWTreeViewCellDelegate <NSObject> |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2833 //@optional |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2834 - (BOOL) queryExpandableInTreeViewCell:(DWTreeViewCell *)treeViewCell; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2835 - (void) treeViewCell:(DWTreeViewCell *)treeViewCell expanded:(BOOL)expanded; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2836 @end |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2837 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2838 @interface DWTreeViewCell : UITableViewCell |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2839 @property(nonatomic, strong) UILabel *titleLabel; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2840 @property(nonatomic) NSUInteger level; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2841 @property(nonatomic) BOOL expanded; |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2842 @property(nonatomic) BOOL children; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2843 @property(nonatomic, assign) id <DWTreeViewCellDelegate> delegate; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2844 -(instancetype)initWithStyle:(UITableViewCellStyle)style |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2845 reuseIdentifier:(NSString *)reuseIdentifier |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2846 level:(NSUInteger)level |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2847 expanded:(BOOL)expanded |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2848 children:(BOOL)children; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2849 @end |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2850 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2851 CGRect DWRectInflate(CGRect rect, CGFloat dx, CGFloat dy) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2852 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2853 return CGRectMake(rect.origin.x-dx, rect.origin.y-dy, rect.size.width+2*dx, rect.size.height+2*dy); |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2854 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2855 |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2856 static CGFloat _DW_TREE_IMG_HEIGHT_WIDTH = 20; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2857 static CGFloat _DW_TREE_XOFFSET = 3; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2858 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2859 @implementation DWTreeViewCell |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2860 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2861 DWButton *_arrowImageButton; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2862 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2863 -(id)initWithStyle:(UITableViewCellStyle)style |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2864 reuseIdentifier:(NSString *)reuseIdentifier |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2865 level:(NSUInteger)level |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2866 expanded:(BOOL)expanded |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2867 children:(BOOL)children |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2868 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2869 // We should never display the root node |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2870 if(level < 1) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2871 return nil; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2872 |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2873 self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2874 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2875 if(self) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2876 { |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2877 _level = level - 1; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2878 _expanded = expanded; |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2879 _children = children; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2880 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2881 UIView *content = self.contentView; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2882 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2883 UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2884 titleLabel.lineBreakMode = NSLineBreakByWordWrapping; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2885 titleLabel.numberOfLines = 0; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2886 titleLabel.textAlignment = NSTextAlignmentLeft; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2887 [content addSubview:titleLabel]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2888 _titleLabel = titleLabel; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2889 |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2890 DWButton *arrowImageButton = [[DWButton alloc] initWithFrame:CGRectMake(0, 0, |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2891 _DW_TREE_IMG_HEIGHT_WIDTH, |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2892 _DW_TREE_IMG_HEIGHT_WIDTH)]; |
2794
7ce51a7e8009
iOS: Fix tree control handling clicks on the expand/collapse button.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2793
diff
changeset
|
2893 [arrowImageButton addTarget:arrowImageButton |
7ce51a7e8009
iOS: Fix tree control handling clicks on the expand/collapse button.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2793
diff
changeset
|
2894 action:@selector(buttonClicked:) |
7ce51a7e8009
iOS: Fix tree control handling clicks on the expand/collapse button.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2793
diff
changeset
|
2895 forControlEvents:UIControlEventTouchUpInside]; |
7ce51a7e8009
iOS: Fix tree control handling clicks on the expand/collapse button.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2793
diff
changeset
|
2896 |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2897 [arrowImageButton setType:_DW_BUTTON_TYPE_TREE]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2898 [arrowImageButton setDidCheckedChanged:^(BOOL checked) { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2899 _expanded = checked; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2900 if([_delegate respondsToSelector:@selector(treeViewCell:expanded:)]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2901 [_delegate treeViewCell:self expanded:checked]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2902 }]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2903 [arrowImageButton setCheckState:_expanded]; |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2904 [arrowImageButton setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2905 if(!children) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2906 [arrowImageButton setHidden:YES]; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2907 [content addSubview:arrowImageButton]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2908 _arrowImageButton = arrowImageButton; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2909 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2910 return self; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2911 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2912 #pragma mark - |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2913 #pragma mark Other overrides |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2914 -(void)layoutSubviews |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2915 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2916 [super layoutSubviews]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2917 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2918 CGSize size = self.contentView.bounds.size; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2919 CGFloat stepSize = size.height; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2920 CGRect rc = CGRectMake(_level * stepSize, 0, stepSize, stepSize); |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2921 _arrowImageButton.frame = DWRectInflate(rc, -_DW_TREE_XOFFSET, -_DW_TREE_XOFFSET); |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2922 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2923 rc = CGRectMake((_level + 1) * stepSize, 0, stepSize, stepSize); |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2924 self.imageView.frame = DWRectInflate(rc, -_DW_TREE_XOFFSET, -_DW_TREE_XOFFSET); |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2925 _titleLabel.frame = CGRectMake((_level + 2) * stepSize, 0, size.width - (_level + 3) * stepSize, stepSize); |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2926 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2927 @end |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2928 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2929 @class DWTree; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2930 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2931 @protocol DWTreeViewDelegate <NSObject> |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2932 @required |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2933 -(NSInteger)numberOfRowsInTreeView:(DWTree *)treeView; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2934 -(DWTreeItem *)treeView:(DWTree *)treeView treeItemForRow:(NSInteger)row; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2935 -(NSInteger)treeView:(DWTree *)treeView rowForTreeItem:(DWTreeItem *)treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2936 -(void)treeView:(DWTree *)treeView removeTreeItem:(DWTreeItem *)treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2937 -(void)treeView:(DWTree *)treeView moveTreeItem:(DWTreeItem *)treeItem to:(DWTreeItem *)to; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2938 -(void)treeView:(DWTree *)treeView addTreeItem:(DWTreeItem *)treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2939 -(void)treeView:(DWTree *)treeView didSelectForTreeItem:(DWTreeItem *)treeItem; |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
2940 -(UIContextMenuConfiguration *)treeView:(DWTree *)treeView contextMenuConfigurationForTreeItem:(DWTreeItem *)treeItem point:(CGPoint)point; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2941 -(BOOL)treeView:(DWTree *)treeView queryExpandableInTreeItem:(DWTreeItem *)treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2942 -(void)treeView:(DWTree *)treeView treeItem:(DWTreeItem *)treeItem expanded:(BOOL)expanded; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2943 @optional |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2944 -(BOOL)treeView:(DWTree *)treeView canEditTreeItem:(DWTreeItem *)treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2945 -(BOOL)treeView:(DWTree *)treeView canMoveTreeItem:(DWTreeItem *)treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2946 @end |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2947 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2948 @interface DWTree : UITableView |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2949 @property(nonatomic, strong) UIFont *font; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2950 @property(nonatomic, strong) DWTreeItem *treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2951 @property(nonatomic, weak) id<DWTreeViewDelegate> treeViewDelegate; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2952 -(instancetype)initWithFrame:(CGRect)frame; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2953 -(void)insertTreeItem:(DWTreeItem *)treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2954 @end |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2955 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2956 @interface DWTree () <UITableViewDataSource, UITableViewDelegate, DWTreeViewCellDelegate, DWTreeViewDelegate> |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2957 @end |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2958 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2959 @implementation DWTree |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2960 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2961 DWTreeItem *_rootNode; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2962 DWTreeItem *_selectedNode; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2963 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2964 -(instancetype)initWithFrame:(CGRect)frame |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2965 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2966 if(self = [super initWithFrame:frame]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2967 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2968 self.delegate=self; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2969 self.dataSource=self; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2970 _treeViewDelegate=self; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2971 self.separatorStyle= UITableViewCellSeparatorStyleNone; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2972 _font = [UIFont systemFontOfSize:16]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2973 _rootNode = [[[DWTreeItem alloc] initWithIcon:nil Title:@"@Root" andData:NULL] retain]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2974 _rootNode.expanded = YES; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2975 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2976 return self; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2977 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2978 -(void)dealloc { [_rootNode release]; [super dealloc]; } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2979 -(void)insertTreeItem:(DWTreeItem *)treeItem |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2980 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2981 DWTreeItem *targetNode = nil; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
2982 |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2983 if([self window]) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2984 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2985 NSArray<DWTreeViewCell *> *cells = [self visibleCells]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2986 |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2987 // Target the selected tree node first if any |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2988 for(DWTreeViewCell *cell in cells) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2989 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2990 DWTreeItem *iter = [self treeItemForTreeViewCell:cell]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2991 if(iter == _selectedNode) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2992 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2993 targetNode = iter; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2994 break; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2995 } |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2996 } |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2997 // Otherwise target first visible node if any |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2998 if(targetNode == nil && [cells count]) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
2999 targetNode = [self treeItemForTreeViewCell:cells[0]]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
3000 } |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3001 // Finally put it on the root level |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3002 if(targetNode == nil) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3003 targetNode = _rootNode; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3004 // If target is still nil something went horrible wrong |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3005 NSAssert(targetNode, @"targetNode == nil, something went wrong!"); |
2766
9b9bc2c2bbad
iOS: Skip displaying the root node, it just represents the tree itself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2765
diff
changeset
|
3006 if(targetNode.isRoot) |
9b9bc2c2bbad
iOS: Skip displaying the root node, it just represents the tree itself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2765
diff
changeset
|
3007 [targetNode appendChild:treeItem]; |
9b9bc2c2bbad
iOS: Skip displaying the root node, it just represents the tree itself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2765
diff
changeset
|
3008 else |
9b9bc2c2bbad
iOS: Skip displaying the root node, it just represents the tree itself.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2765
diff
changeset
|
3009 [targetNode insertChildAfter:treeItem]; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3010 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3011 if([_treeViewDelegate respondsToSelector:@selector(treeView:addTreeItem:)]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3012 [_treeViewDelegate treeView:self addTreeItem:treeItem]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3013 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3014 [self reloadData]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3015 [self resetSelection:NO]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3016 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3017 -(void)setFont:(UIFont *)font |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3018 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3019 _font = font; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3020 [self reloadData]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3021 [self resetSelection:NO]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3022 } |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
3023 -(void)clear |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
3024 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
3025 [[_rootNode children] removeAllObjects]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
3026 [self reloadData]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
3027 [self resetSelection:NO]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
3028 } |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3029 -(void)resetSelection:(BOOL)delay |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3030 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3031 NSInteger row = NSNotFound; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3032 if([_treeViewDelegate respondsToSelector:@selector(treeView:rowForTreeItem:)]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3033 row = [_treeViewDelegate treeView:self rowForTreeItem:_selectedNode]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3034 if(row != NSNotFound) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3035 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3036 NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3037 dispatch_block_t run = ^ { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3038 [self selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3039 }; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3040 if(delay) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3041 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), run); |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3042 else |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3043 run(); |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3044 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3045 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3046 #pragma mark - DWTreeViewDelegate |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3047 -(NSInteger)numberOfRowsInTreeView:(DWTree *)treeView { return [_rootNode visibleNodes].count; } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3048 -(void)treeView:(DWTree *)treeView addTreeItem:(DWTreeItem *)treeItem {} |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3049 -(void)treeView:(DWTree *)treeView didSelectForTreeItem:(DWTreeItem *)treeItem |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3050 { |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3051 if(treeItem) |
2772
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
3052 { |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
3053 const char *title = [[treeItem title] UTF8String]; |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
3054 NSPointerArray *params = [NSPointerArray pointerArrayWithOptions:NSPointerFunctionsOpaqueMemory]; |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
3055 |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
3056 [params addPointer:strdup(title ? title : "")]; |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
3057 [params addPointer:[treeItem data]]; |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
3058 [params addPointer:treeItem]; |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
3059 _dw_event_handler(treeView, params, _DW_EVENT_ITEM_SELECT); |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
3060 free([params pointerAtIndex:0]); |
af9dc4c2c0df
iOS: Use NSPointerArray in all _DW_EVENT_ITEM_SELECT cases.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2771
diff
changeset
|
3061 } |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3062 } |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3063 -(UIContextMenuConfiguration *)treeView:(DWTree *)treeView contextMenuConfigurationForTreeItem:(DWTreeItem *)treeItem point:(CGPoint)point |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3064 { |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3065 UIContextMenuConfiguration *config = nil; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3066 DWWindow *window = (DWWindow *)[self window]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3067 const char *title = [[treeItem title] UTF8String]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3068 NSPointerArray *params = [NSPointerArray pointerArrayWithOptions:NSPointerFunctionsOpaqueMemory]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3069 |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3070 [params addPointer:strdup(title ? title : "")]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3071 [params addPointer:[treeItem data]]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3072 [params addPointer:DW_INT_TO_POINTER((int)point.x)]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3073 [params addPointer:DW_INT_TO_POINTER((int)point.y)]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3074 |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3075 _dw_event_point = point; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3076 _dw_event_handler(self, params, _DW_EVENT_ITEM_CONTEXT); |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3077 free([params pointerAtIndex:0]); |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3078 |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3079 if(window && [window popupMenu]) |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3080 { |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3081 __block UIMenu *popupmenu = [[[window popupMenu] menu] retain]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3082 config = [UIContextMenuConfiguration configurationWithIdentifier:nil |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3083 previewProvider:nil |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3084 actionProvider:^(NSArray* suggestedAction){return popupmenu;}]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3085 [window setPopupMenu:nil]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3086 } |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3087 return config; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3088 } |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3089 -(void)treeView:(DWTree *)treeView moveTreeItem:(DWTreeItem *)treeItem to:(DWTreeItem *)to {} |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3090 -(BOOL)treeView:(DWTree *)treeView queryExpandableInTreeItem:(DWTreeItem *)treeItem { return YES; } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3091 -(void)treeView:(DWTree *)treeView removeTreeItem:(DWTreeItem *)treeItem {} |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3092 -(NSInteger)treeView:(DWTree *)treeView rowForTreeItem:(DWTreeItem *)treeItem { return [[_rootNode visibleNodes] indexOfObject:treeItem]; } |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3093 -(void)treeView:(DWTree *)treeView treeItem:(DWTreeItem *)treeItem expanded:(BOOL)expanded |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3094 { |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3095 if(treeItem) |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3096 _dw_event_handler(treeView, (void *)treeItem, _DW_EVENT_TREE_EXPAND); |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3097 } |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3098 - (DWTreeItem *)treeView:(DWTree *)treeView treeItemForRow:(NSInteger)row { return [[_rootNode visibleNodes] objectAtIndex:row]; } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3099 #pragma mark - UITableViewDataSource |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3100 -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3101 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3102 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3103 NSInteger count = 0; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3104 if([_treeViewDelegate respondsToSelector:@selector(numberOfRowsInTreeView:)]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3105 count = [_treeViewDelegate numberOfRowsInTreeView:self]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3106 return count; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3107 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3108 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3109 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3110 static NSString *CellIdentifier = @"Cell"; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3111 |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3112 DWTreeItem *treeItem = [self treeItemForIndexPath:indexPath]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3113 DWTreeViewCell *cell = [[DWTreeViewCell alloc] initWithStyle:UITableViewCellStyleDefault |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3114 reuseIdentifier:CellIdentifier |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3115 level:[treeItem levelDepth] |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
3116 expanded:treeItem.expanded |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
3117 children:[treeItem hasChildren]]; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3118 cell.titleLabel.text = treeItem.title; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3119 cell.imageView.image = treeItem.icon; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3120 cell.titleLabel.font = _font; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3121 //cell.selectionStyle = UITableViewCellSelectionStyleNone; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3122 cell.delegate = self; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3123 return cell; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3124 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3125 -(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3126 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3127 DWTreeItem *treeItem = [self treeItemForIndexPath:indexPath]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3128 if([_treeViewDelegate respondsToSelector:@selector(treeView:canEditTreeItem:)]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3129 return [_treeViewDelegate treeView:self canEditTreeItem:treeItem]; |
2769
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
3130 return NO; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3131 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3132 -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3133 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3134 DWTreeItem *treeItem = [self treeItemForIndexPath:indexPath]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3135 if(editingStyle == UITableViewCellEditingStyleDelete) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3136 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3137 [treeItem removeFromParent]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3138 if([_treeViewDelegate respondsToSelector:@selector(treeView:removeTreeItem:)]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3139 [_treeViewDelegate treeView:self removeTreeItem:treeItem]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3140 if(treeItem.expanded && treeItem.hasChildren) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3141 [self reloadData]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3142 else |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3143 [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3144 [self resetSelection:YES]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3145 } else if (editingStyle == UITableViewCellEditingStyleInsert) { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3146 // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3147 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3148 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3149 -(void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3150 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3151 if([fromIndexPath isEqual:toIndexPath]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3152 return; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3153 DWTreeItem *srcNode = [self treeItemForIndexPath:fromIndexPath]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3154 DWTreeItem *targetNode = [self treeItemForIndexPath:toIndexPath]; |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3155 |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3156 if(srcNode && targetNode) |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3157 { |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3158 [srcNode moveToDestination:targetNode]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3159 |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3160 if([_treeViewDelegate respondsToSelector:@selector(treeView:moveTreeItem:to:)]) |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3161 [_treeViewDelegate treeView:self moveTreeItem:srcNode to:targetNode]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3162 |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3163 [self reloadData]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3164 [self resetSelection:NO]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3165 } |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3166 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3167 -(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3168 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3169 DWTreeItem *treeItem = [self treeItemForIndexPath:indexPath]; |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3170 if(treeItem && [_treeViewDelegate respondsToSelector:@selector(treeView:canMoveTreeItem:)]) |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3171 return [_treeViewDelegate treeView:self canMoveTreeItem:treeItem]; |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3172 return NO; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3173 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3174 #pragma mark - DWTableViewDelegate |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3175 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3176 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3177 DWTreeItem *treeItem = [self treeItemForIndexPath:indexPath]; |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3178 if(treeItem && [_treeViewDelegate respondsToSelector:@selector(treeView:didSelectForTreeItem:)]) |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3179 [_treeViewDelegate treeView:self didSelectForTreeItem:treeItem]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3180 _selectedNode = treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3181 } |
2770
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3182 -(UIContextMenuConfiguration *)tableView:(UITableView *)tableView contextMenuConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath point:(CGPoint)point |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3183 { |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3184 UIContextMenuConfiguration *config = nil; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3185 DWTreeItem *treeItem = [self treeItemForIndexPath:indexPath]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3186 if(treeItem && [_treeViewDelegate respondsToSelector:@selector(treeView:contextMenuConfigurationForTreeItem:point:)]) |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3187 config = [_treeViewDelegate treeView:self contextMenuConfigurationForTreeItem:treeItem point:point]; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3188 |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3189 return config; |
f42d78f136b6
iOS: Implement tree context menus and all the signal handler/callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2769
diff
changeset
|
3190 } |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3191 -(NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3192 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3193 DWTreeItem *srcNode = [self treeItemForIndexPath:sourceIndexPath]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3194 DWTreeItem *targetNode = [self treeItemForIndexPath:proposedDestinationIndexPath]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3195 if([srcNode containsTreeItem:targetNode] || srcNode==targetNode) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3196 return sourceIndexPath; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3197 // NSLog(@"Moving to target node \"%@\"", targetNode.title); |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3198 return proposedDestinationIndexPath; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3199 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3200 #pragma mark - DWTreeViewCellDelegate |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3201 -(BOOL)queryExpandableInTreeViewCell:(DWTreeViewCell *)treeViewCell |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3202 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3203 BOOL allow = YES; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3204 if([_treeViewDelegate respondsToSelector:@selector(treeView:queryExpandableInTreeItem:)]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3205 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3206 DWTreeItem *treeItem = [self treeItemForTreeViewCell:treeViewCell]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3207 allow = [_treeViewDelegate treeView:self queryExpandableInTreeItem:treeItem]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3208 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3209 return allow; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3210 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3211 -(void)treeViewCell:(DWTreeViewCell *)treeViewCell expanded:(BOOL)expanded |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3212 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3213 DWTreeItem *treeItem = [self treeItemForTreeViewCell:treeViewCell]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3214 treeItem.expanded = expanded; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3215 if(treeItem.hasChildren) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3216 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3217 [self reloadData]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3218 [self resetSelection:NO]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3219 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3220 if([_treeViewDelegate respondsToSelector:@selector(treeView:treeItem:expanded:)]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3221 [_treeViewDelegate treeView:self treeItem:treeItem expanded:expanded]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3222 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3223 #pragma mark - retrieve TreeItem object from special cell |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3224 -(DWTreeItem *)treeItemForTreeViewCell:(DWTreeViewCell *)treeViewCell |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3225 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3226 NSIndexPath *indexPath = [self indexPathForCell:treeViewCell]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3227 return [self treeItemForIndexPath:indexPath]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3228 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3229 -(DWTreeItem *)treeItemForIndexPath:(NSIndexPath *)indexPath |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3230 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3231 DWTreeItem *treeItem = nil; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3232 if([_treeViewDelegate respondsToSelector:@selector(treeView:treeItemForRow:)]) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3233 treeItem = [_treeViewDelegate treeView:self treeItemForRow:indexPath.row]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3234 NSAssert(treeItem, @"Can't get the Tree Node data"); |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3235 return treeItem; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3236 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3237 @end |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
3238 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3239 /* 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
|
3240 @interface DWCalendar : UIDatePicker |
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 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3243 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3244 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3245 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3246 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3247 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3248 @implementation DWCalendar |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3249 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3250 -(void)setUserdata:(void *)input { userdata = input; } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3251 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3252 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3253 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3254 /* 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
|
3255 /* 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
|
3256 @interface DWStepper : UIStepper |
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 id textfield; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3259 id parent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3260 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3261 -(void)setTextfield:(id)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3262 -(id)textfield; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3263 -(void)setParent:(id)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3264 -(id)parent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3265 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3266 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3267 @implementation DWStepper |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3268 -(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
|
3269 -(id)textfield { return textfield; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3270 -(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
|
3271 -(id)parent { return parent; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3272 @end |
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 /* 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
|
3275 @interface DWSpinButton : UIView <UITextFieldDelegate> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3276 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3277 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3278 UITextField *textfield; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3279 DWStepper *stepper; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3280 id clickDefault; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3281 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3282 -(id)init; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3283 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3284 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3285 -(UITextField *)textfield; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3286 -(UIStepper *)stepper; |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
3287 -(void)textFieldDidEndEditing:(UITextField *)textField; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3288 -(void)setClickDefault:(id)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3289 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3290 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3291 @implementation DWSpinButton |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3292 -(id)init |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3293 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3294 self = [super init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3295 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3296 if(self) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3297 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3298 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
|
3299 [self addSubview:textfield]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3300 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
|
3301 [self addSubview:stepper]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3302 [stepper setParent:self]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3303 [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
|
3304 [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
|
3305 [textfield setDelegate:self]; |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
3306 [stepper addTarget:self action:@selector(stepperChanged:) forControlEvents:UIControlEventValueChanged]; |
2372
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 return self; |
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 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3311 -(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
|
3312 -(UITextField *)textfield { return textfield; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3313 -(UIStepper *)stepper { return stepper; } |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
3314 -(void)textFieldDidEndEditing:(UITextField *)textField |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3315 { |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3316 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
|
3317 [stepper setValue:(float)val]; |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
3318 [textfield setText:[NSString stringWithFormat:@"%d", (int)[stepper value]]]; |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
3319 _dw_event_handler(self, DW_INT_TO_POINTER((int)[stepper value]), _DW_EVENT_VALUE_CHANGED); |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
3320 } |
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
3321 -(void)stepperChanged:(UIStepper*)theStepper |
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
3322 { |
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
3323 [textfield setText:[NSString stringWithFormat:@"%d", (int)[theStepper value]]]; |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
3324 _dw_event_handler(self, DW_INT_TO_POINTER((int)[stepper value]), _DW_EVENT_VALUE_CHANGED); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3325 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3326 -(void)setClickDefault:(id)input { clickDefault = input; } |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3327 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3328 @end |
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 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
|
3331 @interface DWUserNotificationCenterDelegate : NSObject <UNUserNotificationCenterDelegate> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3332 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3333 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3334 @implementation DWUserNotificationCenterDelegate |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3335 /* 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
|
3336 -(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
|
3337 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3338 completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3339 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3340 /* 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
|
3341 -(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
|
3342 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3343 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
|
3344 unsigned long long handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3345 HWND notification; |
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 /* 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
|
3348 [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
|
3349 [objScanner scanUnsignedLongLong:&handle]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3350 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
|
3351 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3352 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
|
3353 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3354 /* 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
|
3355 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
|
3356 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3357 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
|
3358 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3359 /* The user launched the app. */ |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
3360 _dw_event_handler(notification, nil, _DW_EVENT_CLICKED); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3361 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
|
3362 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3363 completionHandler(); |
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 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3366 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3367 @interface DWComboBox : UITextField <UIPickerViewDelegate,UIPickerViewDataSource,UITextFieldDelegate> |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3368 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3369 UIPickerView* pickerView; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3370 NSMutableArray* dataArray; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3371 UIBarStyle toolbarStyle; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3372 int selectedIndex; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3373 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3374 -(void)setToolbarStyle:(UIBarStyle)style; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3375 -(void)append:(NSString *)item; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3376 -(void)insert:(NSString *)item atIndex:(int)index; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3377 -(void)clear; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3378 -(int)count; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3379 -(NSString *)getTextAtIndex:(int)index; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3380 -(void)setText:(NSString *)item atIndex:(int)index; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3381 -(void)deleteAtIndex:(int)index; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3382 -(int)selectedIndex; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3383 @end |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3384 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3385 @implementation DWComboBox |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3386 -(id)init |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3387 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3388 self = [super init]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3389 if(self) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3390 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3391 [self setDelegate:self]; |
2433
87669cfe3c92
iOS: Combobox remove code to hide the input caret. Also fix the cancel button.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2432
diff
changeset
|
3392 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3393 /* Set UI defaults */ |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3394 toolbarStyle = UIBarStyleDefault; |
2442
725a6fbb44cd
iOS: DWComboBox needs to initialize the array so the list works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2440
diff
changeset
|
3395 dataArray = [[NSMutableArray alloc] init]; |
2433
87669cfe3c92
iOS: Combobox remove code to hide the input caret. Also fix the cancel button.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2432
diff
changeset
|
3396 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3397 /* Setup the arrow image */ |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3398 UIButton *imageButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3399 UIImage *image = [UIImage systemImageNamed:@"chevron.down"]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3400 [imageButton setImage:image forState:UIControlStateNormal]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3401 [self setRightView:imageButton]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3402 [self setRightViewMode:UITextFieldViewModeAlways]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3403 [imageButton addTarget:self action:@selector(showPicker:) forControlEvents:UIControlEventTouchUpInside]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3404 selectedIndex = -1; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3405 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3406 return self; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3407 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3408 -(void)setToolbarStyle:(UIBarStyle)style { toolbarStyle = style; } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3409 -(void)append:(NSString *)item { if(item) [dataArray addObject:item]; } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3410 -(void)insert:(NSString *)item atIndex:(int)index { if(item) [dataArray insertObject:item atIndex:index]; } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3411 -(void)clear { [dataArray removeAllObjects]; } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3412 -(int)count { return (int)[dataArray count]; } |
2804
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
3413 -(void)selectIndex:(int)index |
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
3414 { |
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
3415 if(index > -1 && index < (int)[dataArray count]) |
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
3416 { |
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
3417 selectedIndex = index; |
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
3418 [self setText:[dataArray objectAtIndex:index]]; |
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
3419 } |
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
3420 } |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3421 -(NSString *)getTextAtIndex:(int)index |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3422 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3423 if(index > -1 && index < [dataArray count]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3424 return [dataArray objectAtIndex:index]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3425 return nil; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3426 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3427 -(void)setText:(NSString *)item atIndex:(int)index |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3428 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3429 if(item && index > -1 && index < [dataArray count]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3430 [dataArray replaceObjectAtIndex:index withObject:item]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3431 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3432 -(void)deleteAtIndex:(int)index { if(index > -1 && index < [dataArray count]) [dataArray removeObjectAtIndex:index]; } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3433 -(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 1; } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3434 -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3435 { |
2698
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
3436 if(row > -1 && row < [dataArray count]) |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
3437 { |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
3438 selectedIndex = (int)row; |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
3439 [self setText:[dataArray objectAtIndex:row]]; |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
3440 [self sendActionsForControlEvents:UIControlEventValueChanged]; |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
3441 _dw_event_handler(self, DW_INT_TO_POINTER(selectedIndex), _DW_EVENT_LIST_SELECT); |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
3442 } |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3443 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3444 -(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { return [dataArray count]; } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3445 -(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3446 { |
2698
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
3447 if(row > -1 && row < [dataArray count]) |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
3448 return [dataArray objectAtIndex:row]; |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
3449 return nil; |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3450 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3451 -(void)doneClicked:(id)sender |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3452 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3453 /* Hides the pickerView */ |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3454 [self resignFirstResponder]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3455 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3456 if([[self text] length] == 0 || ![dataArray containsObject:[self text]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3457 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3458 selectedIndex = -1; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3459 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3460 [self sendActionsForControlEvents:UIControlEventValueChanged]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3461 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3462 -(void)cancelClicked:(id)sender |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3463 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3464 /* Hides the pickerView */ |
2433
87669cfe3c92
iOS: Combobox remove code to hide the input caret. Also fix the cancel button.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2432
diff
changeset
|
3465 [self resignFirstResponder]; |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3466 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3467 -(void)showPicker:(id)sender |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3468 { |
2738
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3469 [self resignFirstResponder]; |
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3470 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3471 pickerView = [[UIPickerView alloc] init]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3472 [pickerView setDataSource:self]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3473 [pickerView setDelegate:self]; |
2738
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3474 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3475 /* If the text field is empty show the place holder otherwise show the last selected option */ |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3476 if([[self text] length] == 0 || ![dataArray containsObject:[self text]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3477 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3478 [pickerView selectRow:0 inComponent:0 animated:YES]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3479 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3480 else |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3481 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3482 if([dataArray containsObject:[self text]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3483 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3484 [pickerView selectRow:[dataArray indexOfObject:[self text]] inComponent:0 animated:YES]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3485 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3486 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3487 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3488 UIToolbar* toolbar = [[UIToolbar alloc] init]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3489 [toolbar setBarStyle:toolbarStyle]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3490 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3491 /* Space between buttons */ |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3492 UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3493 target:nil |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3494 action:nil]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3495 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3496 UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3497 initWithTitle:@"Done" |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3498 style:UIBarButtonItemStyleDone |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3499 target:self |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3500 action:@selector(doneClicked:)]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3501 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3502 UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3503 initWithTitle:@"Cancel" |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3504 style:UIBarButtonItemStylePlain |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3505 target:self |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3506 action:@selector(cancelClicked:)]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3507 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3508 [toolbar setItems:[NSArray arrayWithObjects:cancelButton, flexibleSpace, doneButton, nil]]; |
2738
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3509 [toolbar sizeToFit]; |
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3510 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3511 /* Custom input view */ |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3512 [self setInputView:pickerView]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3513 [self setInputAccessoryView:toolbar]; |
2738
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3514 [super becomeFirstResponder]; |
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3515 } |
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3516 -(BOOL)becomeFirstResponder |
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3517 { |
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3518 [self setInputView:nil]; |
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3519 [self setInputAccessoryView:nil]; |
c2387166a414
iOS: Improve the combobox. Trigger the input view when touching the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2737
diff
changeset
|
3520 return [super becomeFirstResponder]; |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3521 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3522 -(int)selectedIndex { return selectedIndex; } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3523 @end |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
3524 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3525 /* 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
|
3526 * 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
|
3527 * 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
|
3528 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3529 @interface DWMDI : DWBox {} |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3530 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3531 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3532 @implementation DWMDI |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3533 @end |
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 /* 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
|
3536 */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3537 void _dw_new_signal(ULONG message, HWND window, int msgid, void *signalfunction, void *discfunc, void *data) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3538 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
3539 DWSignalHandler *new = malloc(sizeof(DWSignalHandler)); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3540 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3541 new->message = message; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3542 new->window = window; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3543 new->id = msgid; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3544 new->signalfunction = signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3545 new->discfunction = discfunc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3546 new->data = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3547 new->next = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3548 |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
3549 if (!DWRoot) |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
3550 DWRoot = new; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3551 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3552 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
3553 DWSignalHandler *prev = NULL, *tmp = DWRoot; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3554 while(tmp) |
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 if(tmp->message == message && |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3557 tmp->window == window && |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3558 tmp->id == msgid && |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3559 tmp->signalfunction == signalfunction) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3560 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3561 tmp->data = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3562 free(new); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3563 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3564 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3565 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3566 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3567 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3568 if(prev) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3569 prev->next = new; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3570 else |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
3571 DWRoot = new; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3572 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3573 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3574 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3575 /* Finds the message number for a given signal name */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3576 ULONG _dw_findsigmessage(const char *signame) |
2372
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 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3579 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3580 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
|
3581 { |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
3582 if(strcasecmp(signame, DWSignalTranslate[z].name) == 0) |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
3583 return DWSignalTranslate[z].message; |
2372
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 return 0L; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3586 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3587 |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
3588 unsigned long _dw_foreground = 0xAAAAAA, _dw_background = 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3589 |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3590 void _dw_handle_resize_events(Box *thisbox) |
2372
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 int z; |
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 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
|
3595 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3596 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
|
3597 |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
3598 if(thisbox->items[z].type == _DW_TYPE_BOX) |
2372
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 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
|
3601 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3602 if(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3603 { |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3604 _dw_handle_resize_events(tmp); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3605 } |
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 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3608 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3609 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
|
3610 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3611 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
|
3612 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
|
3613 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
|
3614 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3615 /* Eliminate duplicate configure requests */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3616 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
|
3617 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3618 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
|
3619 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3620 [render setSize:newsize]; |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
3621 _dw_event_handler(handle, nil, _DW_EVENT_CONFIGURE); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3622 } |
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 /* 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
|
3626 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
|
3627 { |
2413
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3628 DWNotebook *notebook = handle; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3629 NSInteger intpageid = [[notebook tabs] selectedSegmentIndex]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3630 |
2419
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3631 if(intpageid != -1 && intpageid < [[notebook views] count]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3632 { |
2413
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3633 DWNotebookPage *page = [[notebook views] objectAtIndex:intpageid]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3634 |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3635 if([page isKindOfClass:[DWBox class]]) |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3636 { |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3637 Box *box = [page box]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3638 _dw_handle_resize_events(box); |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3639 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3640 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3641 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3642 /* 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
|
3643 * 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
|
3644 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3645 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
|
3646 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3647 DWScrollBox *scrollbox = (DWScrollBox *)handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3648 NSArray *subviews = [scrollbox subviews]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3649 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
|
3650 Box *thisbox = [contentbox box]; |
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 /* Get the required space for the box */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3653 _dw_handle_resize_events(thisbox); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3654 } |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3659 /* 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
|
3660 * 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
|
3661 */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3662 static void _dw_resize_box(Box *thisbox, int *depth, int x, int y, int pass) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3663 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3664 /* Current item position */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3665 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
|
3666 /* 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
|
3667 * 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
|
3668 * 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
|
3669 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3670 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
|
3671 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
|
3672 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3673 /* Reset the box sizes */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3674 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
|
3675 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3676 /* 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
|
3677 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
|
3678 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3679 int itempad, itemwidth, itemheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3680 |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
3681 if(thisbox->items[z].type == _DW_TYPE_BOX) |
2372
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 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
|
3684 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
|
3685 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3686 if(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3687 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3688 /* 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
|
3689 if(pass == 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3690 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3691 (*depth)++; |
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 /* Save the newly calculated values on the box */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3694 _dw_resize_box(tmp, depth, x, y, pass); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3695 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3696 /* 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
|
3697 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
|
3698 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
|
3699 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3700 /* 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
|
3701 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
|
3702 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
|
3703 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
|
3704 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
|
3705 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3706 (*depth)--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3707 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3708 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3709 } |
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 /* 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
|
3712 * 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
|
3713 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3714 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
|
3715 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
|
3716 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
|
3717 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3718 /* 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
|
3719 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
|
3720 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3721 if(itemwidth > uxmax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3722 uxmax = itemwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3723 |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
3724 if(thisbox->items[z].hsize != _DW_SIZE_EXPAND) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3725 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3726 if(itemwidth > upxmax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3727 upxmax = itemwidth; |
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 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3730 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3731 if(itempad > upxmax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3732 upxmax = itempad; |
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 thisbox->minheight += itemheight; |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
3735 if(thisbox->items[z].vsize != _DW_SIZE_EXPAND) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3736 thisbox->usedpady += itemheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3737 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3738 thisbox->usedpady += itempad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3739 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3740 else |
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 if(itemheight > uymax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3743 uymax = itemheight; |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
3744 if(thisbox->items[z].vsize != _DW_SIZE_EXPAND) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3745 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3746 if(itemheight > upymax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3747 upymax = itemheight; |
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 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3750 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3751 if(itempad > upymax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3752 upymax = itempad; |
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 thisbox->minwidth += itemwidth; |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
3755 if(thisbox->items[z].hsize != _DW_SIZE_EXPAND) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3756 thisbox->usedpadx += itemwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3757 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3758 thisbox->usedpadx += itempad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3759 } |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3762 /* 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
|
3763 thisbox->minwidth += uxmax; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3764 thisbox->minheight += uymax; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3765 thisbox->usedpadx += upxmax; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3766 thisbox->usedpady += upymax; |
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 /* 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
|
3769 if(pass > 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3770 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3771 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
|
3772 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3773 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
|
3774 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
|
3775 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
|
3776 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
|
3777 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3778 /* Calculate the new sizes */ |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
3779 if(thisbox->items[z].hsize == _DW_SIZE_EXPAND) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3780 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3781 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
|
3782 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3783 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
|
3784 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3785 if(expandablex) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3786 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
|
3787 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3788 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3789 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
|
3790 } |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
3791 if(thisbox->items[z].vsize == _DW_SIZE_EXPAND) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3792 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3793 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
|
3794 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3795 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
|
3796 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3797 if(expandabley) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3798 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
|
3799 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3800 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3801 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
|
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 /* 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
|
3805 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
|
3806 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3807 int pad = thisbox->items[z].pad; |
2413
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3808 id handle = thisbox->items[z].hwnd; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3809 CGRect rect; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3810 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3811 rect.origin.x = currentx + pad; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3812 rect.origin.y = currenty + pad; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3813 rect.size.width = width; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3814 rect.size.height = height; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3815 [handle setFrame:rect]; |
2372
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 /* After placing a box... place its components */ |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
3818 if(thisbox->items[z].type == _DW_TYPE_BOX) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3819 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3820 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
|
3821 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
|
3822 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3823 if(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3824 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3825 (*depth)++; |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3826 _dw_resize_box(tmp, depth, width, height, pass); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3827 (*depth)--; |
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 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3830 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3831 /* 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
|
3832 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
|
3833 { |
2413
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3834 DWNotebook *notebook = handle; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3835 NSInteger intpageid = [[notebook tabs] selectedSegmentIndex]; |
2419
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3836 |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3837 if(intpageid == -1) |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3838 { |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3839 if([[notebook tabs] numberOfSegments] > 0) |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3840 { |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3841 DWNotebookPage *notepage = [[notebook views] firstObject]; |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3842 |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3843 /* If there is no selected segment, select the first one... */ |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3844 [[notebook tabs] setSelectedSegmentIndex:0]; |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3845 intpageid = 0; |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3846 [notepage setHidden:NO]; |
2420
384d076ed52a
iOS: Minor fix for initial notebook page remaining visible on page change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2419
diff
changeset
|
3847 [notebook setVisible:notepage]; |
2419
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3848 } |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3849 } |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3850 |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
3851 if(intpageid != -1 && intpageid < [[notebook views] count]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3852 { |
2413
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3853 DWNotebookPage *page = [[notebook views] objectAtIndex:intpageid]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3854 |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3855 /* If the new page is a valid box, lay it out */ |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3856 if([page isKindOfClass:[DWBox class]]) |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3857 { |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3858 Box *box = [page box]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3859 /* Start with the entire notebook size and then adjust |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3860 * it to account for the segement control's height. |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3861 */ |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3862 NSInteger height = [[notebook tabs] frame].size.height; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3863 CGRect frame = [notebook frame]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3864 frame.origin.y += height; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3865 frame.size.height -= height; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3866 [page setFrame:frame]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3867 _dw_do_resize(box, frame.size.width, frame.size.height); |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3868 _dw_handle_resize_events(box); |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
3869 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3870 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3871 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3872 /* 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
|
3873 * 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
|
3874 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3875 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
|
3876 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3877 int depth = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3878 DWScrollBox *scrollbox = (DWScrollBox *)handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3879 NSArray *subviews = [scrollbox subviews]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3880 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
|
3881 Box *thisbox = [contentbox box]; |
2448
7e1828dd4fe0
iOS: Fix scrollbox content not expanding to take the full area if smaller.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2447
diff
changeset
|
3882 /* We start with the content being the available size */ |
7e1828dd4fe0
iOS: Fix scrollbox content not expanding to take the full area if smaller.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2447
diff
changeset
|
3883 CGRect frame = CGRectMake(0,0,rect.size.width,rect.size.height); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3884 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3885 /* Get the required space for the box */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3886 _dw_resize_box(thisbox, &depth, x, y, 1); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3887 |
2448
7e1828dd4fe0
iOS: Fix scrollbox content not expanding to take the full area if smaller.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2447
diff
changeset
|
3888 /* Expand the content box to the size of the contents */ |
7e1828dd4fe0
iOS: Fix scrollbox content not expanding to take the full area if smaller.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2447
diff
changeset
|
3889 if(frame.size.width < thisbox->minwidth) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3890 { |
2448
7e1828dd4fe0
iOS: Fix scrollbox content not expanding to take the full area if smaller.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2447
diff
changeset
|
3891 frame.size.width = thisbox->minwidth; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3892 } |
2448
7e1828dd4fe0
iOS: Fix scrollbox content not expanding to take the full area if smaller.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2447
diff
changeset
|
3893 if(frame.size.height < thisbox->minheight) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3894 { |
2448
7e1828dd4fe0
iOS: Fix scrollbox content not expanding to take the full area if smaller.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2447
diff
changeset
|
3895 frame.size.height = thisbox->minheight; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3896 } |
2449
6edaa9382046
iOS: Fix scrolling the scrollbox. Make sure scrolling is enabled and set the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2448
diff
changeset
|
3897 [scrollbox setContentSize:frame.size]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3898 [contentbox setFrame:frame]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3899 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3900 /* Layout the content of the scrollbox */ |
2448
7e1828dd4fe0
iOS: Fix scrollbox content not expanding to take the full area if smaller.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2447
diff
changeset
|
3901 _dw_do_resize(thisbox, frame.size.width, frame.size.height); |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3902 _dw_handle_resize_events(thisbox); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3903 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3904 /* 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
|
3905 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
|
3906 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3907 DWSpinButton *spinbutton = (DWSpinButton *)handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3908 UITextField *textfield = [spinbutton textfield]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3909 UIStepper *stepper = [spinbutton stepper]; |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
3910 NSInteger stepperwidth = [stepper intrinsicContentSize].width; |
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
3911 [textfield setFrame:CGRectMake(0,0,rect.size.width-stepperwidth,rect.size.height)]; |
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
3912 [stepper setFrame:CGRectMake(rect.size.width-stepperwidth,0,stepperwidth,rect.size.height)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3913 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3914 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
|
3915 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3916 DWSplitBar *split = (DWSplitBar *)handle; |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
3917 [split resize]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3918 } |
2700
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
3919 else if([handle isMemberOfClass:[DWMLE class]]) |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
3920 { |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
3921 DWMLE *mle = (DWMLE *)handle; |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
3922 |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
3923 if([[mle textContainer] lineBreakMode] == NSLineBreakByClipping) |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
3924 [[mle textContainer] setSize:CGRectInfinite.size]; |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
3925 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3926 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3927 /* 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
|
3928 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
|
3929 currentx += width + (pad * 2); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3930 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
|
3931 currenty += height + (pad * 2); |
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 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3934 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3935 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3936 |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3937 static void _dw_do_resize(Box *thisbox, int x, int y) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3938 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3939 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
|
3940 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3941 if(thisbox) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3942 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3943 int depth = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3944 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3945 /* Calculate space requirements */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3946 _dw_resize_box(thisbox, &depth, x, y, 1); |
2372
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 /* Finally place all the boxes and controls */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
3949 _dw_resize_box(thisbox, &depth, x, y, 2); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3950 } |
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 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3953 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3954 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3955 * 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
|
3956 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3957 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
|
3958 { |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
3959 /* We don't actually run a loop here, |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
3960 * we launched a new thread to run the loop there. |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
3961 * Just wait for dw_main_quit() on the DWMainEvent. |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
3962 */ |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
3963 dw_event_wait(DWMainEvent, DW_TIMEOUT_INFINITE); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3964 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3967 * 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
|
3968 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3969 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
|
3970 { |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
3971 dw_event_post(DWMainEvent); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3972 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3973 |
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 * 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
|
3976 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3977 * 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
|
3978 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3979 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
|
3980 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3981 DWTID curr = pthread_self(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3982 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3983 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
|
3984 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3985 DWTID orig = DWThread; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3986 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
|
3987 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3988 if(orig == (DWTID)-1) |
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 DWThread = curr; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3991 } |
2648
2362cb4b7ef9
iOS: Fix another _dw_main_iteration() loop issue.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2647
diff
changeset
|
3992 /* Process any pending events */ |
2362cb4b7ef9
iOS: Fix another _dw_main_iteration() loop issue.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2647
diff
changeset
|
3993 _dw_main_iteration(until); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3994 if(orig == (DWTID)-1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3995 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3996 DWThread = orig; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3997 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3998 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3999 else |
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 usleep(milliseconds * 1000); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4002 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4003 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4004 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4005 /* 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
|
4006 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
|
4007 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
4008 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
|
4009 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4012 * 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
|
4013 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4014 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
|
4015 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4016 DWTID curr = pthread_self(); |
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 if(DWThread == (DWTID)-1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4019 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4020 DWThread = curr; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4021 _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
|
4022 DWThread = (DWTID)-1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4023 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4024 else if(DWThread == curr) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4025 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4026 _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
|
4027 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4028 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4029 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4030 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4031 * 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
|
4032 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4033 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
|
4034 { |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4038 * 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
|
4039 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4040 * 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
|
4041 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4042 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
|
4043 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4044 dw_shutdown(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4045 exit(exitcode); |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4048 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4049 * 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
|
4050 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4051 * 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
|
4052 * 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
|
4053 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4054 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
|
4055 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4056 free(ptr); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4057 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4058 |
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 * 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
|
4061 * 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
|
4062 * OS/2 and Windows). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4063 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4064 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
|
4065 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4066 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
|
4067 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4068 if(!_user_dir[0]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4069 { |
2787
56312f9c1d6c
iOS: Return the Application Sandbox's Documents folder from dw_user_dir()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2786
diff
changeset
|
4070 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, |
56312f9c1d6c
iOS: Return the Application Sandbox's Documents folder from dw_user_dir()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2786
diff
changeset
|
4071 NSUserDomainMask, YES); |
56312f9c1d6c
iOS: Return the Application Sandbox's Documents folder from dw_user_dir()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2786
diff
changeset
|
4072 NSString *nshome = [paths firstObject]; |
56312f9c1d6c
iOS: Return the Application Sandbox's Documents folder from dw_user_dir()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2786
diff
changeset
|
4073 const char *home; |
56312f9c1d6c
iOS: Return the Application Sandbox's Documents folder from dw_user_dir()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2786
diff
changeset
|
4074 |
56312f9c1d6c
iOS: Return the Application Sandbox's Documents folder from dw_user_dir()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2786
diff
changeset
|
4075 if(nshome && (home = [nshome UTF8String])) |
56312f9c1d6c
iOS: Return the Application Sandbox's Documents folder from dw_user_dir()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2786
diff
changeset
|
4076 strncpy(_user_dir, home, PATH_MAX); |
56312f9c1d6c
iOS: Return the Application Sandbox's Documents folder from dw_user_dir()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2786
diff
changeset
|
4077 else if((nshome = NSHomeDirectory()) && (home = [nshome UTF8String])) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4078 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
|
4079 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4080 strcpy(_user_dir, "/"); |
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 return _user_dir; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4083 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4084 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4085 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4086 * 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
|
4087 * private application data directory. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4088 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4089 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
|
4090 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4091 return _dw_bundle_path; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4092 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4093 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4094 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4095 * 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
|
4096 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4097 * 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
|
4098 * 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
|
4099 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4100 * 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
|
4101 * 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
|
4102 * 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
|
4103 * Remarks: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4104 * 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
|
4105 * 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
|
4106 * 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
|
4107 * 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
|
4108 * 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
|
4109 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4110 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
|
4111 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4112 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
|
4113 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4114 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4115 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4116 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4117 * 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
|
4118 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4119 * 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
|
4120 * ...: 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
|
4121 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4122 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
|
4123 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4124 va_list args; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4125 char outbuf[1025] = {0}; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4126 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4127 va_start(args, format); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4128 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
|
4129 va_end(args); |
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 NSLog(@"%s", outbuf); |
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 * 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
|
4136 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4137 * 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
|
4138 * 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
|
4139 * 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
|
4140 * ...: 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
|
4141 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4142 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
|
4143 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4144 NSInteger iResponse; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4145 NSString *button1 = @"OK"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4146 NSString *button2 = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4147 NSString *button3 = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4148 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
|
4149 NSString *mtext; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
4150 UIAlertControllerStyle mstyle = UIAlertControllerStyleAlert; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4151 NSArray *params; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4152 va_list args; |
2725
2dd68d2810ca
iOS: dw_messagebox() can't be called recursively...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2723
diff
changeset
|
4153 static int in_mb = FALSE; |
2dd68d2810ca
iOS: dw_messagebox() can't be called recursively...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2723
diff
changeset
|
4154 |
2dd68d2810ca
iOS: dw_messagebox() can't be called recursively...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2723
diff
changeset
|
4155 /* Prevent recursion */ |
2dd68d2810ca
iOS: dw_messagebox() can't be called recursively...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2723
diff
changeset
|
4156 if(in_mb) |
2dd68d2810ca
iOS: dw_messagebox() can't be called recursively...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2723
diff
changeset
|
4157 return 0; |
2dd68d2810ca
iOS: dw_messagebox() can't be called recursively...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2723
diff
changeset
|
4158 in_mb = TRUE; |
2372
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 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
|
4161 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4162 button2 = @"Cancel"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4163 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4164 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
|
4165 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4166 button1 = @"Yes"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4167 button2 = @"No"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4168 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4169 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
|
4170 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4171 button1 = @"Yes"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4172 button2 = @"No"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4173 button3 = @"Cancel"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4174 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4175 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4176 va_start(args, format); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4177 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
|
4178 va_end(args); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4179 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4180 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
|
4181 [DWObj safeCall:@selector(messageBox:) withObject:params]; |
2725
2dd68d2810ca
iOS: dw_messagebox() can't be called recursively...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2723
diff
changeset
|
4182 in_mb = FALSE; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4183 iResponse = [[params lastObject] integerValue]; |
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 switch(iResponse) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4186 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
4187 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
|
4188 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
|
4189 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4190 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
|
4191 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4192 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
|
4193 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
|
4194 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
|
4195 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4196 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
|
4197 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4198 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
|
4199 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
|
4200 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
|
4201 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4202 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4203 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4206 * 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
|
4207 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4208 * 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
|
4209 * 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
|
4210 * ext: Default file extention. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4211 * 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
|
4212 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4213 * 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
|
4214 * 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
|
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 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
|
4218 { |
2415
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
4219 NSPointerArray *params = [[NSPointerArray pointerArrayWithOptions:NSPointerFunctionsOpaqueMemory] retain]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
4220 char *file = NULL; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
4221 |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
4222 [params addPointer:(void *)defpath]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
4223 [params addPointer:(void *)ext]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
4224 [params addPointer:DW_INT_TO_POINTER(flags)]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
4225 [DWObj safeCall:@selector(filePicker:) withObject:params]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
4226 if([params count] > 3) |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
4227 file = [params pointerAtIndex:3]; |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
4228 |
f33a81fa29e9
iOS: Implment dw_file_browse() and fix issues in dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2414
diff
changeset
|
4229 return file; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4230 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4231 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4232 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4233 * 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
|
4234 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4235 * None. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4236 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4237 * 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
|
4238 * be converted to text. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4239 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4240 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
|
4241 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
4242 UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
4243 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
|
4244 if(str != nil) |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
4245 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
|
4246 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4247 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4248 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4249 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4250 * 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
|
4251 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4252 * Text. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4253 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4254 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
|
4255 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
4256 UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
4257 |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
4258 [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
|
4259 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4260 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4261 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4262 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4263 * 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
|
4264 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4265 * 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
|
4266 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4267 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
|
4268 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4269 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
|
4270 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4271 if(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4272 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4273 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
|
4274 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
|
4275 tmp->data = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4276 tmp->done = FALSE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4277 tmp->result = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4278 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4279 return tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4280 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4281 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4282 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4283 * 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
|
4284 * 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
|
4285 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4286 * 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
|
4287 * 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
|
4288 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4289 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
|
4290 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4291 dialog->result = result; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4292 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
|
4293 dialog->done = TRUE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4294 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4295 } |
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 * 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
|
4299 * 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
|
4300 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4301 * 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
|
4302 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4303 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
|
4304 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4305 void *tmp = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4306 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4307 if(dialog) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4308 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4309 while(!dialog->done) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4310 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4311 _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
|
4312 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4313 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
|
4314 tmp = dialog->result; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4315 free(dialog); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4316 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4317 return tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4318 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4319 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4320 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4321 * 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
|
4322 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4323 * 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
|
4324 * 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
|
4325 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4326 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
|
4327 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
|
4328 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
|
4329 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
|
4330 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4331 DW_FUNCTION_INIT; |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
4332 DWBox *view = [[[DWBox alloc] init] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4333 Box *newbox = [view box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4334 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
|
4335 newbox->pad = pad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4336 newbox->type = type; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4337 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
|
4338 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4339 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4340 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4341 * 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
|
4342 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4343 * 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
|
4344 * 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
|
4345 * 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
|
4346 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4347 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
|
4348 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
4349 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
|
4350 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4351 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4352 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4353 * 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
|
4354 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4355 * 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
|
4356 * 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
|
4357 */ |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
4358 DW_FUNCTION_DEFINITION(dw_scrollbox_new, HWND, int type, int pad) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
4359 DW_FUNCTION_ADD_PARAM2(type, pad) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
4360 DW_FUNCTION_RETURN(dw_scrollbox_new, HWND) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
4361 DW_FUNCTION_RESTORE_PARAM2(type, int, pad, int) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4362 { |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
4363 DWScrollBox *scrollbox = [[[DWScrollBox alloc] init] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4364 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
|
4365 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
|
4366 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
|
4367 [scrollbox setBox:box]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4368 [scrollbox addSubview:tmpbox]; |
2449
6edaa9382046
iOS: Fix scrolling the scrollbox. Make sure scrolling is enabled and set the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2448
diff
changeset
|
4369 [scrollbox setScrollEnabled:YES]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4370 [tmpbox autorelease]; |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
4371 DW_FUNCTION_RETURN_THIS(scrollbox); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4372 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4373 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4374 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4375 * 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
|
4376 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4377 * 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
|
4378 * 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
|
4379 */ |
2472
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4380 DW_FUNCTION_DEFINITION(dw_scrollbox_get_pos, int, HWND handle, int orient) |
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4381 DW_FUNCTION_ADD_PARAM2(handle, orient) |
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4382 DW_FUNCTION_RETURN(dw_scrollbox_get_pos, int) |
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4383 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, orient, int) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4384 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4385 DWScrollBox *scrollbox = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4386 NSArray *subviews = [scrollbox subviews]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4387 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
|
4388 CGSize contentsize = [scrollbox contentSize]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4389 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
|
4390 int range = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4391 int val = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4392 if(orient == DW_VERT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4393 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4394 range = [view bounds].size.height - contentsize.height; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4395 val = contentoffset.y; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4396 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4397 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4398 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4399 range = [view bounds].size.width - contentsize.width; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4400 val = contentoffset.x; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4401 } |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4402 if(val > range) |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4403 { |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4404 val = range; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4405 } |
2472
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4406 DW_FUNCTION_RETURN_THIS(val); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4407 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4408 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4409 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4410 * 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
|
4411 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4412 * 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
|
4413 * 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
|
4414 */ |
2472
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4415 DW_FUNCTION_DEFINITION(dw_scrollbox_get_range, int, HWND handle, int orient) |
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4416 DW_FUNCTION_ADD_PARAM2(handle, orient) |
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4417 DW_FUNCTION_RETURN(dw_scrollbox_get_range, int) |
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4418 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, orient, int) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4419 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4420 DWScrollBox *scrollbox = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4421 NSArray *subviews = [scrollbox subviews]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4422 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
|
4423 int range = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4424 if(orient == DW_VERT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4425 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4426 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
|
4427 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4428 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4429 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4430 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
|
4431 } |
2472
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4432 DW_FUNCTION_RETURN_THIS(range); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4433 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4434 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4435 /* Return the handle to the text object */ |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
4436 id _dw_text_handle(id object) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4437 { |
2427
4f078d24fe83
iOS: Correct _dw_text_handle() behavior. Add UILabel/UITextView to controls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2426
diff
changeset
|
4438 if([object isMemberOfClass:[DWButton class]]) |
4f078d24fe83
iOS: Correct _dw_text_handle() behavior. Add UILabel/UITextView to controls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2426
diff
changeset
|
4439 { |
4f078d24fe83
iOS: Correct _dw_text_handle() behavior. Add UILabel/UITextView to controls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2426
diff
changeset
|
4440 DWButton *button = object; |
4f078d24fe83
iOS: Correct _dw_text_handle() behavior. Add UILabel/UITextView to controls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2426
diff
changeset
|
4441 object = [button titleLabel]; |
4f078d24fe83
iOS: Correct _dw_text_handle() behavior. Add UILabel/UITextView to controls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2426
diff
changeset
|
4442 } |
4f078d24fe83
iOS: Correct _dw_text_handle() behavior. Add UILabel/UITextView to controls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2426
diff
changeset
|
4443 else if([object isMemberOfClass:[DWSpinButton class]]) |
2372
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 DWSpinButton *spinbutton = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4446 object = [spinbutton textfield]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4447 } |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4448 #if 0 /* TODO: Fix this when we have a groupbox implemented */ |
2427
4f078d24fe83
iOS: Correct _dw_text_handle() behavior. Add UILabel/UITextView to controls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2426
diff
changeset
|
4449 if([object isMemberOfClass:[NSBox class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4450 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4451 NSBox *box = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4452 id content = [box contentView]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4453 |
2427
4f078d24fe83
iOS: Correct _dw_text_handle() behavior. Add UILabel/UITextView to controls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2426
diff
changeset
|
4454 if([content isMemberOfClass:[DWText class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4455 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4456 object = content; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4457 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4458 } |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4459 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4460 return object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4461 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4462 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4463 /* 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
|
4464 * 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
|
4465 * |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4466 * Render/Unspecified: 1x1 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4467 * 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
|
4468 * 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
|
4469 * Spinbutton: 50x(maxfontheight) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4470 * 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
|
4471 * 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
|
4472 * 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
|
4473 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4474 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
|
4475 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4476 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
|
4477 NSString *nsstr = nil; |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
4478 id object = _dw_text_handle(handle); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4479 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4480 /* Handle all the different button types */ |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4481 if([handle isMemberOfClass:[DWButton class]]) |
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4482 { |
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4483 UIImage *image = [handle imageForState:UIControlStateNormal]; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
4484 |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
4485 if(image) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
4486 { |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
4487 /* Image button */ |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
4488 CGSize size = [image size]; |
2423
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4489 extrawidth = (int)size.width + 1; |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4490 /* Height isn't additive */ |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4491 thisheight = (int)size.height + 1; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
4492 } |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
4493 /* Text button */ |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4494 nsstr = [[handle titleLabel] text]; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
4495 |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
4496 if(nsstr && [nsstr length] > 0) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
4497 { |
2423
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4498 /* With combined text/image we seem to |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4499 * need a lot of additional width space. |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4500 */ |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4501 if(image) |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4502 extrawidth += 30; |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4503 else |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4504 extrawidth += 8; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
4505 extraheight += 4; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4506 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4507 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4508 /* If the control is an entryfield set width to 150 */ |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4509 else if([object isKindOfClass:[UITextField class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4510 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4511 UIFont *font = [object font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4512 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4513 if([object isEditable]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4514 { |
2430
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4515 /* Spinbutton text doesn't need to be as wide */ |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4516 if([handle isMemberOfClass:[DWSpinButton class]]) |
2430
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4517 thiswidth = 50; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4518 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4519 thiswidth = 150; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4520 } |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4521 nsstr = [object text]; |
2372
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 if(font) |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4524 thisheight = (int)[font lineHeight]; |
2467
4d1f370bf65e
iOS: Pass in the coordinates and row data on container context event.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2464
diff
changeset
|
4525 |
2430
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4526 /* Spinbuttons need some extra */ |
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4527 if([handle isMemberOfClass:[DWSpinButton class]]) |
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4528 { |
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4529 DWSpinButton *spinbutton = handle; |
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4530 CGSize size = [[spinbutton stepper] intrinsicContentSize]; |
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4531 |
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4532 /* Add the stepper width as extra... */ |
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4533 extrawidth = size.width; |
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4534 /* The height should be the bigger of the two */ |
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4535 if(size.height > thisheight) |
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4536 thisheight = size.height; |
e08968d21d45
iOS: Additional code to calculate spinbutton size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2429
diff
changeset
|
4537 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4538 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4539 /* Handle the ranged widgets */ |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4540 else if([object isMemberOfClass:[DWPercent class]] || |
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4541 [object isMemberOfClass:[DWSlider class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4542 { |
2541
2ee4df2c50bf
iOS: Changes to handle autosizing vertical sliders/scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2540
diff
changeset
|
4543 if([object isMemberOfClass:[DWSlider class]] && [object vertical]) |
2ee4df2c50bf
iOS: Changes to handle autosizing vertical sliders/scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2540
diff
changeset
|
4544 { |
2ee4df2c50bf
iOS: Changes to handle autosizing vertical sliders/scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2540
diff
changeset
|
4545 thiswidth = 25; |
2ee4df2c50bf
iOS: Changes to handle autosizing vertical sliders/scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2540
diff
changeset
|
4546 thisheight = 100; |
2ee4df2c50bf
iOS: Changes to handle autosizing vertical sliders/scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2540
diff
changeset
|
4547 } |
2ee4df2c50bf
iOS: Changes to handle autosizing vertical sliders/scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2540
diff
changeset
|
4548 else |
2ee4df2c50bf
iOS: Changes to handle autosizing vertical sliders/scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2540
diff
changeset
|
4549 { |
2ee4df2c50bf
iOS: Changes to handle autosizing vertical sliders/scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2540
diff
changeset
|
4550 thiswidth = 100; |
2ee4df2c50bf
iOS: Changes to handle autosizing vertical sliders/scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2540
diff
changeset
|
4551 thisheight = 25; |
2ee4df2c50bf
iOS: Changes to handle autosizing vertical sliders/scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2540
diff
changeset
|
4552 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4553 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4554 /* Handle bitmap size */ |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4555 else if([object isMemberOfClass:[UIImageView class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4556 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4557 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
|
4558 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4559 if(image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4560 { |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
4561 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
|
4562 thiswidth = (int)size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4563 thisheight = (int)size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4564 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4565 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4566 /* Handle calendar */ |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4567 else if([object isMemberOfClass:[DWCalendar class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4568 { |
2588
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4569 DWCalendar *calendar = object; |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4570 CGSize size = [calendar intrinsicContentSize]; |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4571 |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4572 /* If we can't detect the size... */ |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4573 if(size.width < 1 || size.height < 1) |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4574 { |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4575 if(DWOSMajor >= 14) |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4576 { |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4577 /* Bigger new style in ios 14 */ |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4578 thiswidth = 200; |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4579 thisheight = 200; |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4580 } |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4581 else |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4582 { |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4583 /* Smaller spinner style in iOS 13 and earlier */ |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4584 thiswidth = 200; |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4585 thisheight = 100; |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4586 } |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4587 } |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4588 else |
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4589 { |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4590 thiswidth = size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4591 thisheight = size.height; |
2588
8253e17b20ad
iOS: Remove some bogus secondary color code in DWBox.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2587
diff
changeset
|
4592 } |
2372
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 /* MLE and Container */ |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4595 else if([object isMemberOfClass:[DWMLE class]] || |
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4596 [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
|
4597 { |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
4598 CGSize size; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4599 |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4600 if([object isMemberOfClass:[DWMLE class]]) |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
4601 size = [object contentSize]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4602 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4603 size = [object getsize]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4604 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4605 thiswidth = size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4606 thisheight = size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4607 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4608 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
|
4609 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
|
4610 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
|
4611 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
|
4612 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
|
4613 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
|
4614 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
|
4615 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
|
4616 } |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4617 else if([object isKindOfClass:[UILabel class]]) |
2423
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4618 { |
2413
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
4619 nsstr = [object text]; |
2423
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4620 extrawidth = extraheight = 2; |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4621 } |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4622 #ifdef DW_INCLUDE_DEPRECATED |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4623 /* Any other control type */ |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4624 else if([object isKindOfClass:[UIControl class]]) |
2413
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
4625 nsstr = [object text]; |
2428
9c5b95d66fc8
iOS: Make spin buttons actually function. Fix layout and autosizing issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2427
diff
changeset
|
4626 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4627 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4628 /* 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
|
4629 * 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
|
4630 */ |
2464
4fba0b9453ee
iOS: Fix calculating label size when there is no text. Use "gT" to calculate
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2463
diff
changeset
|
4631 if(nsstr) |
2423
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4632 { |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4633 int textwidth, textheight; |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4634 |
2464
4fba0b9453ee
iOS: Fix calculating label size when there is no text. Use "gT" to calculate
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2463
diff
changeset
|
4635 /* If we have an empty string, use "gT" to get the most height for the font */ |
4fba0b9453ee
iOS: Fix calculating label size when there is no text. Use "gT" to calculate
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2463
diff
changeset
|
4636 dw_font_text_extents_get(object, NULL, [nsstr length] ? (char *)[nsstr UTF8String] : "gT", &textwidth, &textheight); |
2423
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4637 |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4638 if(textheight > thisheight) |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4639 thisheight = textheight; |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4640 if(textwidth > thiswidth) |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4641 thiswidth = textwidth; |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
4642 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4643 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4644 /* Set the requested sizes */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4645 if(width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4646 *width = thiswidth + extrawidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4647 if(height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4648 *height = thisheight + extraheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4649 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4650 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4651 /* 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
|
4652 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
|
4653 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4654 id object = box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4655 DWBox *view = box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4656 DWBox *this = item; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4657 Box *thisbox; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4658 int z, x = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4659 Item *tmpitem, *thisitem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4660 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4661 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4662 * 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
|
4663 * 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
|
4664 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4665 if(box == item) |
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_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
|
4668 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4669 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4670 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4671 /* Query the objects */ |
2472
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4672 if([object isKindOfClass:[UIWindow class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4673 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4674 UIWindow *window = box; |
2599
32728f6f7ccd
iOS: Add UINavigationBar and DWView to the rootViewController's view.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2598
diff
changeset
|
4675 NSArray *subviews = [[[window rootViewController] view] subviews]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4676 view = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4677 } |
2472
206a0643add6
iOS: Move scrollbox functions into thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2467
diff
changeset
|
4678 else if([object isMemberOfClass:[DWScrollBox class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4679 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4680 DWScrollBox *scrollbox = box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4681 view = [scrollbox box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4682 } |
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 thisbox = [view box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4685 thisitem = thisbox->items; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4686 object = item; |
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 /* 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
|
4689 if(!thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4690 thisbox->count = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4691 if(index < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4692 index = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4693 if(index > thisbox->count) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4694 index = thisbox->count; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4695 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4696 /* Duplicate the existing data */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4697 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
|
4698 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4699 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
|
4700 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4701 if(z == index) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4702 x++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4703 tmpitem[x] = thisitem[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4704 x++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4705 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4706 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4707 /* Sanity checks */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4708 if(vsize && !height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4709 height = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4710 if(hsize && !width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4711 width = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4712 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4713 /* 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
|
4714 if([object isKindOfClass:[DWBox class]]) |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
4715 tmpitem[index].type = _DW_TYPE_BOX; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4716 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4717 { |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
4718 if(width == 0 && hsize == FALSE) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4719 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
4720 if(height == 0 && vsize == FALSE) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4721 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
|
4722 |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
4723 tmpitem[index].type = _DW_TYPE_ITEM; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4724 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4725 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4726 tmpitem[index].hwnd = item; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4727 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
|
4728 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
|
4729 tmpitem[index].pad = pad; |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
4730 tmpitem[index].hsize = hsize ? _DW_SIZE_EXPAND : _DW_SIZE_STATIC; |
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
4731 tmpitem[index].vsize = vsize ? _DW_SIZE_EXPAND : _DW_SIZE_STATIC; |
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
4732 |
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
4733 /* If either of the parameters are -1 (DW_SIZE_AUTO) ... calculate the size */ |
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
4734 if(width == DW_SIZE_AUTO || height == DW_SIZE_AUTO) |
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
4735 _dw_control_size(object, width == DW_SIZE_AUTO ? &tmpitem[index].width : NULL, height == DW_SIZE_AUTO ? &tmpitem[index].height : NULL); |
2372
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 thisbox->items = tmpitem; |
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 /* Update the item count */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4740 thisbox->count++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4741 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4742 /* 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
|
4743 [view addSubview:this]; |
2817
5000a8a43825
iOS: Fix some memory leaks and remove unnecessary code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2813
diff
changeset
|
4744 [this release]; |
5000a8a43825
iOS: Fix some memory leaks and remove unnecessary code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2813
diff
changeset
|
4745 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4746 /* 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
|
4747 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
|
4748 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4749 DWButton *button = (DWButton *)this; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4750 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4751 /* 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
|
4752 * 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
|
4753 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4754 [button setParent:view]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4755 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4756 /* 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
|
4757 _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
|
4758 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4759 /* Free the old data */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4760 if(thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4761 free(thisitem); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4762 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4763 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4764 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4765 * 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
|
4766 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4767 * 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
|
4768 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4769 * 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
|
4770 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4771 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
|
4772 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
|
4773 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
|
4774 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
|
4775 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4776 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4777 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4778 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4779 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
|
4780 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4781 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
|
4782 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4783 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
|
4784 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
4785 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
|
4786 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4787 id window = [object window]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4788 Box *thisbox = [parent box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4789 int z, index = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4790 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
|
4791 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4792 if(!thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4793 thisbox->count = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4794 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4795 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
|
4796 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4797 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
|
4798 index = z; |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4801 if(index == -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4802 retval = DW_ERROR_GENERAL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4803 else |
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 [object retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4806 [object removeFromSuperview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4807 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4808 if(thisbox->count > 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4809 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4810 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
|
4811 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4812 /* 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
|
4813 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
|
4814 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4815 tmpitem[z] = thisitem[z]; |
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 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
|
4818 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4819 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
|
4820 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4821 } |
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 thisbox->items = tmpitem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4824 if(thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4825 free(thisitem); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4826 if(tmpitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4827 thisbox->count--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4828 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4829 thisbox->count = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4830 /* 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
|
4831 _dw_redraw(window, TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4832 } |
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 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4835 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4836 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
|
4837 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4840 * 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
|
4841 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4842 * 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
|
4843 * 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
|
4844 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4845 * 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
|
4846 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4847 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
|
4848 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
|
4849 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
|
4850 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
|
4851 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4852 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4853 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4854 DWBox *parent = (DWBox *)box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4855 id object = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4856 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
4857 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
|
4858 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4859 id window = [parent window]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4860 Box *thisbox = [parent box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4861 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4862 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
|
4863 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4864 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4865 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
|
4866 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4867 object = thisitem[index].hwnd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4868 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4869 if(object) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4870 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4871 [object retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4872 [object removeFromSuperview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4873 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4874 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4875 if(thisbox->count > 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4876 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4877 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
|
4878 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4879 /* 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
|
4880 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
|
4881 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4882 tmpitem[z] = thisitem[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4883 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4884 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
|
4885 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4886 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
|
4887 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4888 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4889 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4890 thisbox->items = tmpitem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4891 if(thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4892 free(thisitem); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4893 if(tmpitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4894 thisbox->count--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4895 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4896 thisbox->count = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4897 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4898 /* 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
|
4899 _dw_redraw(window, TRUE); |
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 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4902 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4903 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
|
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4907 * 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
|
4908 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4909 * 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
|
4910 * 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
|
4911 * 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
|
4912 * 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
|
4913 * 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
|
4914 * 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
|
4915 * 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
|
4916 * 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
|
4917 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
4918 DW_FUNCTION_DEFINITION(dw_box_pack_at_index, void, HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
4919 DW_FUNCTION_ADD_PARAM8(box, item, index, width, height, hsize, vsize, pad) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
4920 DW_FUNCTION_NO_RETURN(dw_box_pack_at_index) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
4921 DW_FUNCTION_RESTORE_PARAM8(box, HWND, item, HWND, index, int, width, int, height, int, hsize, int, vsize, int, pad, int) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4922 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4923 _dw_box_pack(box, item, index, width, height, hsize, vsize, pad, "dw_box_pack_at_index()"); |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
4924 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4925 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4926 |
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 * 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
|
4929 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4930 * 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
|
4931 * 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
|
4932 * 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
|
4933 * 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
|
4934 * 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
|
4935 * 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
|
4936 * 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
|
4937 */ |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
4938 DW_FUNCTION_DEFINITION(dw_box_pack_start, void, HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
4939 DW_FUNCTION_ADD_PARAM7(box, item, width, height, hsize, vsize, pad) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
4940 DW_FUNCTION_NO_RETURN(dw_box_pack_start) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
4941 DW_FUNCTION_RESTORE_PARAM7(box, HWND, item, HWND, width, int, height, int, hsize, int, vsize, int, pad, int) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4942 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4943 /* 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
|
4944 * 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
|
4945 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4946 _dw_box_pack(box, item, 65536, width, height, hsize, vsize, pad, "dw_box_pack_start()"); |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
4947 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4948 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4951 * 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
|
4952 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4953 * 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
|
4954 * 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
|
4955 * 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
|
4956 * 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
|
4957 * 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
|
4958 * 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
|
4959 * 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
|
4960 */ |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
4961 DW_FUNCTION_DEFINITION(dw_box_pack_end, void, HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
4962 DW_FUNCTION_ADD_PARAM7(box, item, width, height, hsize, vsize, pad) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
4963 DW_FUNCTION_NO_RETURN(dw_box_pack_end) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
4964 DW_FUNCTION_RESTORE_PARAM7(box, HWND, item, HWND, width, int, height, int, hsize, int, vsize, int, pad, int) |
2372
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 _dw_box_pack(box, item, 0, width, height, hsize, vsize, pad, "dw_box_pack_end()"); |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
4967 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4968 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4969 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4970 /* Internal function to create a basic button, used by all button types */ |
2591
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
4971 HWND _dw_internal_button_new(const char *text, ULONG cid, UIButtonType type) |
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
4972 { |
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
4973 DWButton *button = [[DWButton buttonWithType:type] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4974 if(text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4975 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4976 [button setTitle:[NSString stringWithUTF8String:text] forState:UIControlStateNormal]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4977 } |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4978 [button addTarget:button |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4979 action:@selector(buttonClicked:) |
2401
010ae32a5067
iOS: Hide the UITransitionView that is attached to the UIWindow.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2400
diff
changeset
|
4980 forControlEvents:UIControlEventTouchUpInside]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4981 [button setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4982 if(DWDefaultFont) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4983 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4984 [[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
|
4985 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4986 return button; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4987 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4988 |
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 * 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
|
4991 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4992 * 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
|
4993 * 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
|
4994 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
4995 DW_FUNCTION_DEFINITION(dw_button_new, HWND, const char *text, ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
4996 DW_FUNCTION_ADD_PARAM2(text, cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
4997 DW_FUNCTION_RETURN(dw_button_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
4998 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
4999 { |
2591
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
5000 DWButton *button = _dw_internal_button_new(text, cid, UIButtonTypeSystem); |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5001 [button setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5002 DW_FUNCTION_RETURN_THIS(button); |
2372
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5005 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5006 * 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
|
5007 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5008 * 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
|
5009 * 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
|
5010 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5011 DW_FUNCTION_DEFINITION(dw_entryfield_new, HWND, const char *text, ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5012 DW_FUNCTION_ADD_PARAM2(text, cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5013 DW_FUNCTION_RETURN(dw_entryfield_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5014 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5015 { |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
5016 DWEntryField *entry = [[[DWEntryField alloc] init] retain]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5017 [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
|
5018 [entry setTag:cid]; |
2704
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
5019 [entry setDelegate:entry]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5020 DW_FUNCTION_RETURN_THIS(entry); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5021 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5024 * 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
|
5025 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5026 * 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
|
5027 * 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
|
5028 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5029 DW_FUNCTION_DEFINITION(dw_entryfield_password_new, HWND, const char *text, ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5030 DW_FUNCTION_ADD_PARAM2(text, cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5031 DW_FUNCTION_RETURN(dw_entryfield_password_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5032 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5033 { |
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
|
5034 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
|
5035 [entry setSecureTextEntry:YES]; |
2704
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
5036 [entry setDelegate:entry]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5037 DW_FUNCTION_RETURN_THIS(entry); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5038 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5039 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5040 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5041 * 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
|
5042 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5043 * 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
|
5044 * 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
|
5045 */ |
2704
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
5046 DW_FUNCTION_DEFINITION(dw_entryfield_set_limit, void, HWND handle, unsigned long limit) |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
5047 DW_FUNCTION_ADD_PARAM2(handle, limit) |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
5048 DW_FUNCTION_NO_RETURN(dw_entryfield_set_limit) |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
5049 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, limit, unsigned long) |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
5050 { |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5051 DWEntryField *entry = handle; |
2704
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
5052 |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
5053 [entry setMaximumLength:limit]; |
ae846e9f1ead
iOS: Implement dw_entryfield_set_limit() using delegate method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2700
diff
changeset
|
5054 DW_FUNCTION_RETURN_NOTHING; |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5057 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5058 * 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
|
5059 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5060 * 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
|
5061 * 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
|
5062 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5063 DW_FUNCTION_DEFINITION(dw_bitmapbutton_new, HWND, DW_UNUSED(const char *text), ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5064 DW_FUNCTION_ADD_PARAM2(text, cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5065 DW_FUNCTION_RETURN(dw_bitmapbutton_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5066 DW_FUNCTION_RESTORE_PARAM2(DW_UNUSED(text), const char *, cid, ULONG) |
2372
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 NSBundle *bundle = [NSBundle mainBundle]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5069 NSString *respath = [bundle resourcePath]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5070 NSString *filepath = [respath stringByAppendingFormat:@"/%lu.png", cid]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5071 UIImage *image = [[UIImage alloc] initWithContentsOfFile:filepath]; |
2591
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
5072 DWButton *button = _dw_internal_button_new("", cid, UIButtonTypeCustom); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5073 if(image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5074 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5075 [button setImage:image forState:UIControlStateNormal]; |
2649
76d876c441c9
iOS: Minor code cleanup in the bitmap button image handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2648
diff
changeset
|
5076 [image release]; |
76d876c441c9
iOS: Minor code cleanup in the bitmap button image handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2648
diff
changeset
|
5077 } |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5078 DW_FUNCTION_RETURN_THIS(button); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5079 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5080 |
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 * 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
|
5083 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5084 * 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
|
5085 * 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
|
5086 * 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
|
5087 * 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
|
5088 * (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
|
5089 */ |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
5090 DW_FUNCTION_DEFINITION(dw_bitmapbutton_new_from_file, HWND, DW_UNUSED(const char *text), ULONG cid, const char *filename) |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5091 DW_FUNCTION_ADD_PARAM3(text, cid, filename) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5092 DW_FUNCTION_RETURN(dw_bitmapbutton_new_from_file, HWND) |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
5093 DW_FUNCTION_RESTORE_PARAM3(DW_UNUSED(text), const char *, cid, ULONG, filename, const char *) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5094 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5095 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
|
5096 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5097 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
|
5098 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
|
5099 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5100 if(!image && ext) |
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 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
|
5103 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
|
5104 } |
2591
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
5105 DWButton *button = _dw_internal_button_new("", cid, UIButtonTypeCustom); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5106 if(image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5107 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5108 [button setImage:image forState:UIControlStateNormal]; |
2649
76d876c441c9
iOS: Minor code cleanup in the bitmap button image handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2648
diff
changeset
|
5109 [image release]; |
76d876c441c9
iOS: Minor code cleanup in the bitmap button image handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2648
diff
changeset
|
5110 } |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5111 DW_FUNCTION_RETURN_THIS(button); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5112 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5113 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5114 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5115 * 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
|
5116 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5117 * 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
|
5118 * 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
|
5119 * 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
|
5120 * (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
|
5121 * len: length of str |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5122 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5123 DW_FUNCTION_DEFINITION(dw_bitmapbutton_new_from_data, HWND, DW_UNUSED(const char *text), ULONG cid, const char *data, int len) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5124 DW_FUNCTION_ADD_PARAM4(text, cid, data, len) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5125 DW_FUNCTION_RETURN(dw_bitmapbutton_new_from_data, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5126 DW_FUNCTION_RESTORE_PARAM4(DW_UNUSED(text), const char *, cid, ULONG, data, const char *, len, int) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5127 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5128 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
|
5129 UIImage *image = [[UIImage alloc] initWithData:thisdata]; |
2591
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
5130 DWButton *button = _dw_internal_button_new("", cid, UIButtonTypeCustom); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5131 if(image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5132 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5133 [button setImage:image forState:UIControlStateNormal]; |
2649
76d876c441c9
iOS: Minor code cleanup in the bitmap button image handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2648
diff
changeset
|
5134 [image release]; |
76d876c441c9
iOS: Minor code cleanup in the bitmap button image handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2648
diff
changeset
|
5135 } |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5136 DW_FUNCTION_RETURN_THIS(button); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5137 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5138 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5139 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5140 * 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
|
5141 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5142 * 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
|
5143 * 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
|
5144 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5145 DW_FUNCTION_DEFINITION(dw_spinbutton_new, HWND, const char *text, ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5146 DW_FUNCTION_ADD_PARAM2(text, cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5147 DW_FUNCTION_RETURN(dw_spinbutton_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5148 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5149 { |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
5150 DWSpinButton *spinbutton = [[[DWSpinButton alloc] init] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5151 UIStepper *stepper = [spinbutton stepper]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5152 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
|
5153 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
|
5154 |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5155 [stepper setStepValue:1]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5156 [stepper setTag:cid]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5157 [stepper setMinimumValue:-65536]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5158 [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
|
5159 [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
|
5160 [textfield setText:[NSString stringWithFormat:@"%ld",val]]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5161 DW_FUNCTION_RETURN_THIS(spinbutton); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5162 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5163 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5164 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5165 * Sets the spinbutton value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5166 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5167 * 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
|
5168 * 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
|
5169 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5170 DW_FUNCTION_DEFINITION(dw_spinbutton_set_pos, void, HWND handle, long position) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5171 DW_FUNCTION_ADD_PARAM2(handle, position) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5172 DW_FUNCTION_NO_RETURN(dw_spinbutton_set_pos) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5173 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, position, long) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5174 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5175 DWSpinButton *spinbutton = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5176 UIStepper *stepper = [spinbutton stepper]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5177 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
|
5178 [stepper setValue:(float)position]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5179 [textfield setText:[NSString stringWithFormat:@"%ld",position]]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5180 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5181 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5182 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5183 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5184 * Sets the spinbutton limits. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5185 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5186 * 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
|
5187 * upper: Upper limit. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5188 * lower: Lower limit. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5189 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5190 DW_FUNCTION_DEFINITION(dw_spinbutton_set_limits, void, HWND handle, long upper, long lower) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5191 DW_FUNCTION_ADD_PARAM3(handle, upper, lower) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5192 DW_FUNCTION_NO_RETURN(dw_spinbutton_set_limits) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5193 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, upper, long, lower, long) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5194 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5195 DWSpinButton *spinbutton = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5196 UIStepper *stepper = [spinbutton stepper]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5197 [stepper setMinimumValue:(double)lower]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5198 [stepper setMaximumValue:(double)upper]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5199 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5200 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5201 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5202 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5203 * 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
|
5204 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5205 * 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
|
5206 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5207 DW_FUNCTION_DEFINITION(dw_spinbutton_get_pos, long, HWND handle) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5208 DW_FUNCTION_ADD_PARAM1(handle) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5209 DW_FUNCTION_RETURN(dw_spinbutton_get_pos, long) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5210 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5211 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5212 DWSpinButton *spinbutton = handle; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5213 long retval; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5214 UIStepper *stepper = [spinbutton stepper]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5215 retval = (long)[stepper value]; |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5216 DW_FUNCTION_RETURN_THIS(retval); |
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 * 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
|
5221 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5222 * 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
|
5223 * 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
|
5224 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5225 DW_FUNCTION_DEFINITION(dw_radiobutton_new, HWND, const char *text, ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5226 DW_FUNCTION_ADD_PARAM2(text, cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5227 DW_FUNCTION_RETURN(dw_radiobutton_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5228 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5229 { |
2591
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
5230 DWButton *button = _dw_internal_button_new(text, cid, UIButtonTypeSystem); |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5231 [button setType:_DW_BUTTON_TYPE_RADIO]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5232 DW_FUNCTION_RETURN_THIS(button); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5233 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5234 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5235 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5236 * 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
|
5237 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5238 * 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
|
5239 * 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
|
5240 * 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
|
5241 */ |
2540
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
5242 DW_FUNCTION_DEFINITION(dw_slider_new, HWND, int vertical, int increments, ULONG cid) |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5243 DW_FUNCTION_ADD_PARAM3(vertical, increments, cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5244 DW_FUNCTION_RETURN(dw_slider_new, HWND) |
2540
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
5245 DW_FUNCTION_RESTORE_PARAM3(vertical, int, increments, int, cid, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5246 { |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
5247 DWSlider *slider = [[[DWSlider alloc] init] retain]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5248 [slider setMaximumValue:(double)increments]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5249 [slider setMinimumValue:0]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5250 [slider setContinuous:YES]; |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5251 [slider addTarget:slider |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5252 action:@selector(sliderChanged:) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5253 forControlEvents:UIControlEventValueChanged]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5254 [slider setTag:cid]; |
2540
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
5255 [slider setVertical:(vertical ? YES : NO)]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5256 DW_FUNCTION_RETURN_THIS(slider); |
2372
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 * 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
|
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 slider to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5263 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5264 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
|
5265 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5266 DWSlider *slider = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5267 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
|
5268 return (int)val; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5269 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5270 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5271 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5272 * Sets the slider position. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5273 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5274 * 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
|
5275 * 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
|
5276 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5277 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
|
5278 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5279 DWSlider *slider = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5280 [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
|
5281 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5282 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5283 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5284 * 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
|
5285 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5286 * 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
|
5287 * 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
|
5288 * 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
|
5289 */ |
2723
27fd270cb0db
iOS: Implement initial color in the color picker dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2718
diff
changeset
|
5290 DW_FUNCTION_DEFINITION(dw_scrollbar_new, HWND, int vertical, ULONG cid) |
27fd270cb0db
iOS: Implement initial color in the color picker dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2718
diff
changeset
|
5291 DW_FUNCTION_ADD_PARAM2(vertical, cid) |
27fd270cb0db
iOS: Implement initial color in the color picker dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2718
diff
changeset
|
5292 DW_FUNCTION_RETURN(dw_scrollbar_new, HWND) |
27fd270cb0db
iOS: Implement initial color in the color picker dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2718
diff
changeset
|
5293 DW_FUNCTION_RESTORE_PARAM2(vertical, int, cid, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5294 { |
2718
2987bf90c7c9
iOS: Hide the UISlider track when using them as scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2712
diff
changeset
|
5295 DWSlider *slider = dw_slider_new(vertical, 1, cid); |
2987bf90c7c9
iOS: Hide the UISlider track when using them as scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2712
diff
changeset
|
5296 [slider setMinimumTrackTintColor:[UIColor clearColor]]; |
2987bf90c7c9
iOS: Hide the UISlider track when using them as scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2712
diff
changeset
|
5297 [slider setMaximumTrackTintColor:[UIColor clearColor]]; |
2723
27fd270cb0db
iOS: Implement initial color in the color picker dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2718
diff
changeset
|
5298 DW_FUNCTION_RETURN_THIS(slider); |
2372
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 |
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 * 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
|
5303 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5304 * 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
|
5305 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5306 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
|
5307 { |
2540
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
5308 return dw_slider_get_pos(handle); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5309 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5312 * Sets the scrollbar position. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5313 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5314 * 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
|
5315 * 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
|
5316 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5317 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
|
5318 { |
2540
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
5319 dw_slider_set_pos(handle, position); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5320 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5323 * Sets the scrollbar range. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5324 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5325 * 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
|
5326 * range: Maximum range value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5327 * 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
|
5328 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5329 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
|
5330 { |
2540
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
5331 DWSlider *slider = handle; |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
5332 [slider setMaximumValue:(double)range]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5333 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5334 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5335 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5336 * 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
|
5337 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5338 * 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
|
5339 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5340 DW_FUNCTION_DEFINITION(dw_percent_new, HWND, ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5341 DW_FUNCTION_ADD_PARAM1(cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5342 DW_FUNCTION_RETURN(dw_percent_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5343 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5344 { |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
5345 DWPercent *percent = [[[DWPercent alloc] init] retain]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5346 [percent setTag:cid]; |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5347 DW_FUNCTION_RETURN_THIS(percent); |
2372
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5350 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5351 * 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
|
5352 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5353 * 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
|
5354 * 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
|
5355 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5356 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
|
5357 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
|
5358 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
|
5359 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
|
5360 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5361 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5362 DWPercent *percent = handle; |
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 /* Handle indeterminate */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5365 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
|
5366 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5367 [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
|
5368 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5369 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5370 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5371 /* Handle normal */ |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5372 [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
|
5373 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5374 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5375 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5376 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5377 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5378 * 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
|
5379 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5380 * 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
|
5381 * 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
|
5382 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5383 DW_FUNCTION_DEFINITION(dw_checkbox_new, HWND, const char *text, ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5384 DW_FUNCTION_ADD_PARAM2(text, cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5385 DW_FUNCTION_RETURN(dw_checkbox_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5386 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5387 { |
2591
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
5388 DWButton *button = _dw_internal_button_new(text, cid, UIButtonTypeSystem); |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5389 [button setType:_DW_BUTTON_TYPE_CHECK]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5390 DW_FUNCTION_RETURN_THIS(button); |
2372
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 |
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 * 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
|
5395 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5396 * 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
|
5397 */ |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5398 DW_FUNCTION_DEFINITION(dw_checkbox_get, int, HWND handle) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5399 DW_FUNCTION_ADD_PARAM1(handle) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5400 DW_FUNCTION_RETURN(dw_checkbox_get, int) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5401 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5402 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5403 DWButton *button = handle; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5404 int retval = FALSE; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5405 |
2700
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
5406 if([button checkState]) |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5407 retval = TRUE; |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5408 DW_FUNCTION_RETURN_THIS(retval); |
2372
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 |
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 * 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
|
5413 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5414 * 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
|
5415 * 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
|
5416 */ |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5417 DW_FUNCTION_DEFINITION(dw_checkbox_set, void, HWND handle, int value) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5418 DW_FUNCTION_ADD_PARAM2(handle, value) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5419 DW_FUNCTION_NO_RETURN(dw_checkbox_set) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5420 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, value, int) |
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5421 { |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5422 DWButton *button = handle; |
2680
1888d0a08365
iOS: Move the check/radio type alignment changes into setType: method.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2679
diff
changeset
|
5423 [button setCheckState:value]; |
2422
4a353a83b2e4
iOS: Initial attempt at implementing check and radio boxes using SF Symbols.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2421
diff
changeset
|
5424 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5425 } |
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 /* 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
|
5428 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
|
5429 { |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
5430 DWContainer *cont = [[[DWContainer alloc] init] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5431 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5432 [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
|
5433 [cont setDataSource:cont]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5434 [cont setDelegate:cont]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5435 [cont setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5436 [cont autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5437 [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
|
5438 return cont; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5439 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5440 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5441 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5442 * 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
|
5443 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5444 * 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
|
5445 * 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
|
5446 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5447 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
|
5448 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
|
5449 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
|
5450 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
|
5451 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5452 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5453 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
|
5454 [cont setup]; |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
5455 [cont addColumn:@"" andType:DW_CFA_STRING]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5456 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
|
5457 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5458 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5459 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5460 * 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
|
5461 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5462 * 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
|
5463 * 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
|
5464 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5465 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
|
5466 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
|
5467 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
|
5468 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
|
5469 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5470 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5471 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5472 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5473 if([object isMemberOfClass:[DWComboBox class]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5474 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5475 DWComboBox *combo = handle; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5476 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5477 [combo append:[NSString stringWithUTF8String:text]]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5478 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5479 else 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
|
5480 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5481 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5482 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
|
5483 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
|
5484 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5485 [cont addRow:newrow]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5486 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
5487 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5488 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5489 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5490 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5493 * 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
|
5494 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5495 * 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
|
5496 * 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
|
5497 * 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
|
5498 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5499 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
|
5500 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
|
5501 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
|
5502 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
|
5503 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5504 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5505 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5506 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5507 if([object isMemberOfClass:[DWComboBox class]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5508 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5509 DWComboBox *combo = handle; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5510 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5511 [combo insert:[NSString stringWithUTF8String:text] atIndex:pos]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5512 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5513 else 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
|
5514 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5515 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5516 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
|
5517 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
|
5518 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5519 [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
|
5520 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
5521 [cont setNeedsDisplay]; |
2372
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_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5524 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5525 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5526 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5527 * 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
|
5528 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5529 * 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
|
5530 * 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
|
5531 * 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
|
5532 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5533 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
|
5534 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
|
5535 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
|
5536 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
|
5537 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5538 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5539 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5540 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5541 if([object isMemberOfClass:[DWComboBox class]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5542 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5543 DWComboBox *combo = handle; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5544 int z; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5545 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5546 for(z=0;z<count;z++) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5547 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5548 NSString *nstr = [NSString stringWithUTF8String:text[z]]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5549 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5550 [combo append:nstr]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5551 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5552 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5553 else 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
|
5554 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5555 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5556 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5557 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5558 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
|
5559 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5560 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
|
5561 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
|
5562 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5563 [cont addRow:newrow]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5564 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5565 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
5566 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5567 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5568 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5569 } |
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 * 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
|
5573 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5574 * 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
|
5575 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5576 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
|
5577 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
|
5578 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
|
5579 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
|
5580 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5581 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5582 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5583 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5584 if([object isMemberOfClass:[DWComboBox class]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5585 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5586 DWComboBox *combo = handle; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5587 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5588 [combo clear]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5589 } |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5590 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
|
5591 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5592 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5593 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5594 [cont clear]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5595 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
5596 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5597 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5598 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5599 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5600 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5601 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5602 * 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
|
5603 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5604 * 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
|
5605 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5606 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
|
5607 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
|
5608 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
|
5609 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
|
5610 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5611 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5612 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5613 int result = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5614 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5615 if([object isMemberOfClass:[DWComboBox class]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5616 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5617 DWComboBox *combo = handle; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5618 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5619 result = [combo count]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5620 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5621 else 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
|
5622 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5623 DWContainer *cont = handle; |
2388
d84cd4227b21
iOS: Switch to UITableViewDataSource method numberOfRowsInSection:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2387
diff
changeset
|
5624 result = (int)[cont numberOfRowsInSection:0]; |
2372
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 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
|
5627 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5628 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5629 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5630 * 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
|
5631 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5632 * 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
|
5633 * 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
|
5634 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5635 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
|
5636 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
|
5637 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
|
5638 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
|
5639 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5640 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5641 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5642 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5643 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
|
5644 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5645 DWContainer *cont = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5646 NSIndexPath *myIP = [NSIndexPath indexPathForRow:top inSection:0]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5647 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5648 [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
|
5649 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5650 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5651 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5652 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5653 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5654 * 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
|
5655 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5656 * 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
|
5657 * 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
|
5658 * 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
|
5659 * 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
|
5660 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5661 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
|
5662 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
|
5663 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
|
5664 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
|
5665 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5666 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5667 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5668 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5669 if([object isMemberOfClass:[DWComboBox class]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5670 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5671 DWComboBox *combo = handle; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5672 NSString *nstr = [combo getTextAtIndex:index]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5673 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5674 if(nstr) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5675 strncpy(buffer, [nstr UTF8String], length - 1); |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5676 else |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5677 *buffer = '\0'; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5678 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5679 else 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
|
5680 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5681 DWContainer *cont = handle; |
2388
d84cd4227b21
iOS: Switch to UITableViewDataSource method numberOfRowsInSection:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2387
diff
changeset
|
5682 int count = (int)[cont numberOfRowsInSection:0]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5683 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5684 if(index > count) |
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 *buffer = '\0'; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5687 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5688 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5689 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5690 UITableViewCell *cell = [cont getRow:index and:0]; |
2417
ccfc4ee9c4a7
iOS: Missed a few other DWContainer fixes in that last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2416
diff
changeset
|
5691 NSString *nstr = [[cell textLabel] text]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5692 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5693 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
|
5694 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5695 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5696 DW_FUNCTION_RETURN_NOTHING; |
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 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
|
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 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
|
5703 * 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
|
5704 * 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
|
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_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
|
5707 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
|
5708 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
|
5709 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
|
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 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5713 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5714 if([object isMemberOfClass:[DWComboBox class]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5715 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5716 DWComboBox *combo = handle; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5717 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5718 [combo setText:[NSString stringWithUTF8String:buffer] atIndex:index]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5719 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5720 else 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
|
5721 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5722 DWContainer *cont = handle; |
2388
d84cd4227b21
iOS: Switch to UITableViewDataSource method numberOfRowsInSection:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2387
diff
changeset
|
5723 int count = (int)[cont numberOfRowsInSection:0]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5724 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5725 if(index <= count) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5726 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5727 NSString *nstr = [NSString stringWithUTF8String:buffer]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5728 UITableViewCell *cell = [cont getRow:index and:0]; |
2417
ccfc4ee9c4a7
iOS: Missed a few other DWContainer fixes in that last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2416
diff
changeset
|
5729 |
ccfc4ee9c4a7
iOS: Missed a few other DWContainer fixes in that last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2416
diff
changeset
|
5730 [[cell textLabel] setText:nstr]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5731 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
5732 [cont setNeedsDisplay]; |
2372
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 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5736 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5737 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5738 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5739 * 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
|
5740 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5741 * 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
|
5742 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5743 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
|
5744 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
|
5745 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
|
5746 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
|
5747 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5748 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5749 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5750 int result = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5751 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5752 if([object isMemberOfClass:[DWComboBox class]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5753 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5754 DWComboBox *combo = handle; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5755 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5756 result = [combo selectedIndex]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5757 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5758 else 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
|
5759 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5760 DWContainer *cont = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5761 NSIndexPath *ip = [cont indexPathForSelectedRow]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5762 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5763 if(ip) |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5764 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
|
5765 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5766 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
|
5767 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5768 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5769 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5770 * 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
|
5771 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5772 * 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
|
5773 * 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
|
5774 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5775 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
|
5776 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
|
5777 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
|
5778 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
|
5779 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5780 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5781 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5782 int retval = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5783 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5784 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
|
5785 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5786 DWContainer *cont = handle; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5787 NSArray *selected = [cont indexPathsForSelectedRows]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5788 NSIndexPath *ip = [selected objectAtIndex:(where == -1 ? 0 :where)]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5789 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5790 if(ip) |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5791 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
|
5792 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5793 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
|
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5797 * 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
|
5798 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5799 * 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
|
5800 * index: Item index. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5801 * 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
|
5802 */ |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5803 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
|
5804 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
|
5805 DW_FUNCTION_NO_RETURN(dw_listbox_select) |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5806 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
|
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 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5810 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5811 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
|
5812 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5813 DWContainer *cont = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5814 NSIndexPath *ip = [NSIndexPath indexPathForRow:index inSection:0]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5815 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5816 [cont selectRowAtIndexPath:ip |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5817 animated:NO |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5818 scrollPosition:UITableViewScrollPositionNone]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5819 } |
2804
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
5820 else if([object isMemberOfClass:[DWComboBox class]]) |
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
5821 { |
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
5822 DWComboBox *combo = handle; |
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
5823 [combo selectIndex:index]; |
deefe6f5d716
iOS: Implement dw_listbox_select() for comboboxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2794
diff
changeset
|
5824 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5825 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5826 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5827 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5828 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5829 * 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
|
5830 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5831 * 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
|
5832 * index: Item index. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5833 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5834 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
|
5835 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
|
5836 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
|
5837 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
|
5838 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5839 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5840 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5841 |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5842 if([object isMemberOfClass:[DWComboBox class]]) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5843 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5844 DWComboBox *combo = handle; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5845 |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5846 [combo deleteAtIndex:index]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5847 } |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5848 else 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
|
5849 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5850 DWContainer *cont = handle; |
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 [cont removeRow:index]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5853 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
5854 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5855 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5856 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5857 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5858 |
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 * 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
|
5861 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5862 * 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
|
5863 * 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
|
5864 */ |
2432
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5865 DW_FUNCTION_DEFINITION(dw_combobox_new, HWND, const char *text, ULONG cid) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5866 DW_FUNCTION_ADD_PARAM2(text, cid) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5867 DW_FUNCTION_RETURN(dw_combobox_new, HWND) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5868 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5869 { |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5870 DWComboBox *combo = [[DWComboBox alloc] init]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5871 if(text) |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5872 [combo setText:[NSString stringWithUTF8String:text]]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5873 [combo setTag:cid]; |
5e0507e67c5d
iOS: Initial implementation of DWComboBox, not fully functional yet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2430
diff
changeset
|
5874 DW_FUNCTION_RETURN_THIS(combo); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5875 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5876 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5877 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5878 * 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
|
5879 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5880 * 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
|
5881 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5882 DW_FUNCTION_DEFINITION(dw_mle_new, HWND, ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5883 DW_FUNCTION_ADD_PARAM1(cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5884 DW_FUNCTION_RETURN(dw_mle_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5885 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5886 { |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
5887 CGRect frame = CGRectMake(0, 0, 100, 50); |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
5888 NSTextContainer *tc = [[NSTextContainer alloc] initWithSize:frame.size]; |
2421
d88928a85436
iOS: Fix DWMLE, have to created it like this to have valid textStorage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2420
diff
changeset
|
5889 NSLayoutManager *lm = [[NSLayoutManager alloc] init]; |
d88928a85436
iOS: Fix DWMLE, have to created it like this to have valid textStorage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2420
diff
changeset
|
5890 NSTextStorage *ts = [[NSTextStorage alloc] init]; |
d88928a85436
iOS: Fix DWMLE, have to created it like this to have valid textStorage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2420
diff
changeset
|
5891 [lm addTextContainer:tc]; |
d88928a85436
iOS: Fix DWMLE, have to created it like this to have valid textStorage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2420
diff
changeset
|
5892 [ts addLayoutManager:lm]; |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
5893 DWMLE *mle = [[[DWMLE alloc] initWithFrame:frame textContainer:tc] retain]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5894 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
|
5895 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5896 size.width = size.height; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5897 [mle setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth]; |
2699
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
5898 [mle setScrollEnabled:YES]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5899 [mle setTag:cid]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5900 [mle autorelease]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
5901 DW_FUNCTION_RETURN_THIS(mle); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5902 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5903 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5904 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5905 * 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
|
5906 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5907 * 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
|
5908 * 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
|
5909 * 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
|
5910 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5911 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
|
5912 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
|
5913 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
|
5914 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
|
5915 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5916 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5917 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5918 unsigned int retval; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5919 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5920 NSString *nstr = [NSString stringWithUTF8String:buffer]; |
2444
ba24ddb19a43
iOS: Fix font and colors on MLE imported text.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2443
diff
changeset
|
5921 UIColor *fgcolor = [mle textColor]; |
ba24ddb19a43
iOS: Fix font and colors on MLE imported text.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2443
diff
changeset
|
5922 UIFont *font = [mle font]; |
ba24ddb19a43
iOS: Fix font and colors on MLE imported text.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2443
diff
changeset
|
5923 NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init]; |
ba24ddb19a43
iOS: Fix font and colors on MLE imported text.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2443
diff
changeset
|
5924 [attributes setObject:(fgcolor ? fgcolor : [UIColor labelColor]) forKey:NSForegroundColorAttributeName]; |
ba24ddb19a43
iOS: Fix font and colors on MLE imported text.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2443
diff
changeset
|
5925 if(font) |
ba24ddb19a43
iOS: Fix font and colors on MLE imported text.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2443
diff
changeset
|
5926 [attributes setObject:font forKey:NSFontAttributeName]; |
ba24ddb19a43
iOS: Fix font and colors on MLE imported text.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2443
diff
changeset
|
5927 NSAttributedString *nastr = [[NSAttributedString alloc] initWithString:nstr attributes:attributes]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5928 NSUInteger length = [ts length]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5929 if(startpoint < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5930 startpoint = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5931 if(startpoint > length) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5932 startpoint = (int)length; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5933 [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
|
5934 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
|
5935 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
|
5936 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5939 * 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
|
5940 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5941 * 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
|
5942 * 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
|
5943 * 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
|
5944 * 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
|
5945 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5946 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
|
5947 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
|
5948 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
|
5949 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
|
5950 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5951 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5952 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5953 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5954 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5955 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
|
5956 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
|
5957 buffer[length] = '\0'; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5958 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5959 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5960 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5961 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5962 * 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
|
5963 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5964 * 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
|
5965 * 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
|
5966 * 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
|
5967 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5968 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
|
5969 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
|
5970 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
|
5971 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
|
5972 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5973 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5974 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5975 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5976 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5977 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
|
5978 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5979 if(bytes) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5980 *bytes = stringLength; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5981 if(lines) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5982 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5983 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
|
5984 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
|
5985 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5986 *lines = numberOfLines; |
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 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5989 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5990 |
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 * 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
|
5993 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5994 * 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
|
5995 * 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
|
5996 * 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
|
5997 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5998 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
|
5999 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
|
6000 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
|
6001 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
|
6002 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6003 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6004 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6005 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6006 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6007 NSUInteger mslength = [ms length]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6008 if(startpoint < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6009 startpoint = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6010 if(startpoint > mslength) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6011 startpoint = (int)mslength; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6012 if(startpoint + length > mslength) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6013 length = (int)mslength - startpoint; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6014 [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
|
6015 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6016 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6017 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6018 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6019 * 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
|
6020 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6021 * 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
|
6022 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6023 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
|
6024 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
|
6025 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
|
6026 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
|
6027 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6028 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6029 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6030 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6031 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6032 NSUInteger length = [ms length]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6033 [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
|
6034 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6035 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6036 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6037 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6038 * 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
|
6039 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6040 * 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
|
6041 * 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
|
6042 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6043 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
|
6044 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
|
6045 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
|
6046 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
|
6047 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6048 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6049 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6050 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6051 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6052 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
|
6053 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6054 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
|
6055 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
|
6056 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6057 if(line == numberOfLines) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6058 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6059 [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
|
6060 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6061 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6062 } |
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 * 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
|
6066 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6067 * 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
|
6068 * 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
|
6069 */ |
2699
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6070 DW_FUNCTION_DEFINITION(dw_mle_set_editable, void, HWND handle, int state) |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6071 DW_FUNCTION_ADD_PARAM2(handle, state) |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6072 DW_FUNCTION_NO_RETURN(dw_mle_set_editable) |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6073 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, state, int) |
2372
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 DWMLE *mle = handle; |
2699
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6076 [mle setEditable:(state ? YES : NO)]; |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6077 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6078 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6079 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6080 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6081 * 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
|
6082 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6083 * 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
|
6084 * 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
|
6085 */ |
2699
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6086 DW_FUNCTION_DEFINITION(dw_mle_set_word_wrap, void, HWND handle, int state) |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6087 DW_FUNCTION_ADD_PARAM2(handle, state) |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6088 DW_FUNCTION_NO_RETURN(dw_mle_set_word_wrap) |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6089 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, state, int) |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6090 { |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6091 DWMLE *mle = handle; |
2700
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
6092 |
2699
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6093 [[mle textContainer] setLineBreakMode:(state ? NSLineBreakByWordWrapping : NSLineBreakByClipping)]; |
2700
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
6094 [[mle textContainer] setWidthTracksTextView:(state ? YES : NO)]; |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
6095 if(!state) |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
6096 [[mle textContainer] setSize:CGRectInfinite.size]; |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
6097 else |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
6098 { |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
6099 CGSize size = [mle frame].size; |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
6100 [[mle textContainer] setSize:CGSizeMake(size.width, CGRectInfinite.size.height)]; |
246f23670e3b
iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2699
diff
changeset
|
6101 } |
2699
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6102 DW_FUNCTION_RETURN_NOTHING; |
2372
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6106 * 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
|
6107 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6108 * 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
|
6109 * 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
|
6110 */ |
2699
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6111 DW_FUNCTION_DEFINITION(dw_mle_set_auto_complete, void, HWND handle, int state) |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6112 DW_FUNCTION_ADD_PARAM2(handle, state) |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6113 DW_FUNCTION_NO_RETURN(dw_mle_set_auto_complete) |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6114 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, state, int) |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6115 { |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6116 DWMLE *mle = handle; |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6117 NSInteger autocorrect = (state & DW_MLE_COMPLETE_TEXT) ? UITextAutocorrectionTypeYes : UITextAutocorrectionTypeNo; |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6118 [mle setAutocorrectionType:autocorrect]; |
0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2698
diff
changeset
|
6119 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6120 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6121 |
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 * 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
|
6124 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6125 * 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
|
6126 * 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
|
6127 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6128 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
|
6129 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
|
6130 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
|
6131 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
|
6132 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6133 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6134 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6135 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6136 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6137 NSUInteger length = [ms length]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6138 if(point < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6139 point = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6140 if(point > length) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6141 point = (int)length; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6142 [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
|
6143 [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
|
6144 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6145 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6146 |
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 * 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
|
6149 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6150 * 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
|
6151 * 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
|
6152 * 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
|
6153 * flags: Search specific flags. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6154 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6155 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
|
6156 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
|
6157 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
|
6158 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
|
6159 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6160 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6161 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6162 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6163 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6164 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
|
6165 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
|
6166 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
|
6167 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
|
6168 int retval = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6169 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6170 if(ms) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6171 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
|
6172 if(range.location == NSNotFound) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6173 retval = (int)range.location; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6174 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
|
6175 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6176 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6177 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6178 * 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
|
6179 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6180 * 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
|
6181 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6182 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
|
6183 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6184 /* 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
|
6185 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6188 * 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
|
6189 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6190 * 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
|
6191 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6192 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
|
6193 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6194 /* 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
|
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 * 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
|
6199 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6200 * 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
|
6201 * 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
|
6202 */ |
2540
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6203 DW_FUNCTION_DEFINITION(dw_status_text_new, HWND, const char *text, ULONG cid) |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6204 DW_FUNCTION_ADD_PARAM2(text, cid) |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6205 DW_FUNCTION_RETURN(dw_status_text_new, HWND) |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6206 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG) |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6207 { |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6208 DWText *textfield = [[[DWText alloc] init] retain]; |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6209 [textfield setText:[NSString stringWithUTF8String:text]]; |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6210 [textfield setTag:cid]; |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6211 if(DWDefaultFont) |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6212 { |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6213 [textfield setFont:DWDefaultFont]; |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6214 } |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6215 [textfield layer].borderWidth = 2.0; |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6216 [textfield layer].borderColor = [[UIColor darkGrayColor] CGColor]; |
1c17472a175a
iOS: Implement scrollbars as sliders... implement vertical with a transform.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2532
diff
changeset
|
6217 DW_FUNCTION_RETURN_THIS(textfield); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6218 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6219 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6220 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6221 * 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
|
6222 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6223 * 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
|
6224 * 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
|
6225 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
6226 DW_FUNCTION_DEFINITION(dw_text_new, HWND, const char *text, ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
6227 DW_FUNCTION_ADD_PARAM2(text, cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
6228 DW_FUNCTION_RETURN(dw_text_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
6229 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6230 { |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
6231 DWText *textfield = [[[DWText alloc] init] retain]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
6232 [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
|
6233 [textfield setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6234 if(DWDefaultFont) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6235 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
6236 [textfield setFont:DWDefaultFont]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
6237 } |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
6238 DW_FUNCTION_RETURN_THIS(textfield); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6239 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6240 |
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 * 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
|
6243 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6244 * 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
|
6245 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6246 * 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
|
6247 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
6248 DW_FUNCTION_DEFINITION(dw_render_new, HWND, ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
6249 DW_FUNCTION_ADD_PARAM1(cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
6250 DW_FUNCTION_RETURN(dw_render_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
6251 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6252 { |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
6253 DWRender *render = [[[DWRender alloc] init] retain]; |
2606
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
6254 UIContextMenuInteraction *interaction = [[UIContextMenuInteraction alloc] initWithDelegate:render]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6255 [render setTag:cid]; |
2606
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
6256 [render addInteraction:interaction]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
6257 DW_FUNCTION_RETURN_THIS(render); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6258 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6259 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6260 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6261 * 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
|
6262 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6263 * 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
|
6264 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6265 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
|
6266 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
|
6267 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
|
6268 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
|
6269 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6270 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6271 DWRender *render = (DWRender *)handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6272 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
6273 [render setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6274 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6275 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6276 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6277 /* 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
|
6278 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6279 * red: red value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6280 * green: green value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6281 * blue: blue value. |
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 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
|
6284 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6285 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
|
6286 UIColor *newcolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6287 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6288 |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
6289 _dw_foreground = _dw_get_color(value); |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
6290 |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
6291 newcolor = [[UIColor colorWithRed: DW_RED_VALUE(_dw_foreground)/255.0 green: |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
6292 DW_GREEN_VALUE(_dw_foreground)/255.0 blue: |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
6293 DW_BLUE_VALUE(_dw_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
|
6294 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
|
6295 [oldcolor release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6296 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6297 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6298 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6299 /* 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
|
6300 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6301 * red: red value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6302 * green: green value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6303 * blue: blue value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6304 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6305 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
|
6306 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6307 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
|
6308 UIColor *newcolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6309 DW_LOCAL_POOL_IN; |
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 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
|
6312 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6313 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
|
6314 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6315 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6316 { |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
6317 _dw_background = _dw_get_color(value); |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
6318 |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
6319 newcolor = [[UIColor colorWithRed: DW_RED_VALUE(_dw_background)/255.0 green: |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
6320 DW_GREEN_VALUE(_dw_background)/255.0 blue: |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
6321 DW_BLUE_VALUE(_dw_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
|
6322 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
|
6323 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6324 [oldcolor release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6325 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6326 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6327 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6328 /* 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
|
6329 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6330 * value: current color |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6331 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6332 * 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
|
6333 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6334 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
|
6335 { |
2723
27fd270cb0db
iOS: Implement initial color in the color picker dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2718
diff
changeset
|
6336 NSMutableArray *params = [NSMutableArray arrayWithObject:[NSNumber numberWithUnsignedLong:_dw_get_color(value)]]; |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
6337 unsigned long newcolor = value; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
6338 |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
6339 [DWObj safeCall:@selector(colorPicker:) withObject:params]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
6340 if([params count] > 1) |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
6341 newcolor = [[params lastObject] unsignedLongValue]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
6342 |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
6343 return newcolor; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6344 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6345 |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6346 CGContextRef _dw_draw_context(id source, bool antialiased) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6347 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6348 CGContextRef context = nil; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6349 |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6350 if([source isMemberOfClass:[DWImage class]]) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6351 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6352 DWImage *image = source; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6353 |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6354 context = [image cgcontext]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6355 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6356 if(context) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6357 CGContextSetAllowsAntialiasing(context, antialiased); |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6358 return context; |
2372
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 |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6361 DWImage *_dw_dest_image(HPIXMAP pixmap, id object) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6362 { |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6363 if(pixmap && pixmap->image) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6364 return pixmap->image; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6365 if([object isMemberOfClass:[DWRender class]]) |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6366 return [object cachedImage]; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6367 return nil; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6368 } |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6369 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6370 /* 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
|
6371 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6372 * 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
|
6373 * 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
|
6374 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6375 * y: Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6376 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6377 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
|
6378 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
|
6379 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
|
6380 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
|
6381 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6382 DW_FUNCTION_INIT; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6383 DWImage *bi = _dw_dest_image(pixmap, handle); |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6384 CGContextRef context = _dw_draw_context(bi, NO); |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6385 |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6386 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6387 UIGraphicsPushContext(context); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6388 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6389 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6390 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6391 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
|
6392 [aPath setLineWidth: 0.5]; |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
6393 [_dw_fg_color set]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6394 |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6395 [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
|
6396 [aPath stroke]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6397 } |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6398 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6399 UIGraphicsPopContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6400 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6401 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6402 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6403 /* 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
|
6404 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6405 * 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
|
6406 * 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
|
6407 * x1: First X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6408 * y1: First Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6409 * x2: Second X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6410 * y2: Second Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6411 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6412 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
|
6413 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
|
6414 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
|
6415 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
|
6416 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6417 DW_FUNCTION_INIT; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6418 DWImage *bi = _dw_dest_image(pixmap, handle); |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6419 CGContextRef context = _dw_draw_context(bi, NO); |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6420 |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6421 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6422 UIGraphicsPushContext(context); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6423 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6424 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6425 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6426 UIBezierPath* aPath = [UIBezierPath bezierPath]; |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
6427 [_dw_fg_color set]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6428 |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6429 [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
|
6430 [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
|
6431 [aPath stroke]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6432 } |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6433 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6434 UIGraphicsPopContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6435 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6436 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6437 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6438 /* 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
|
6439 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6440 * 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
|
6441 * 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
|
6442 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6443 * y: Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6444 * 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
|
6445 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6446 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
|
6447 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
|
6448 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
|
6449 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
|
6450 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6451 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6452 NSString *nstr = [ NSString stringWithUTF8String:text ]; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6453 DWImage *bi = nil; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6454 UIFont *font = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6455 DWRender *render; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6456 id image = handle; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6457 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6458 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6459 { |
2395
2618277de356
iOS: Code error cleanup reported by LLVM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2393
diff
changeset
|
6460 bi = (id)pixmap->image; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6461 font = pixmap->font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6462 render = pixmap->handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6463 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
|
6464 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6465 font = [render font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6466 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6467 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6468 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
|
6469 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6470 render = image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6471 font = [render font]; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6472 bi = [render cachedImage]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6473 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6474 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6475 { |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6476 CGContextRef context = _dw_draw_context(bi, NO); |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6477 |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6478 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6479 UIGraphicsPushContext(context); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6480 |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
6481 NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:_dw_fg_color, NSForegroundColorAttributeName, nil]; |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
6482 if(_dw_bg_color) |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
6483 [dict setValue:_dw_bg_color forKey:NSBackgroundColorAttributeName]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6484 if(font) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6485 [dict setValue:font forKey:NSFontAttributeName]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6486 [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
|
6487 [dict release]; |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6488 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6489 UIGraphicsPopContext(); |
2372
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 DW_FUNCTION_RETURN_NOTHING; |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6494 /* 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
|
6495 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6496 * 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
|
6497 * 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
|
6498 * 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
|
6499 * 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
|
6500 * 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
|
6501 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6502 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
|
6503 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6504 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6505 NSString *nstr; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6506 UIFont *font = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6507 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6508 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6509 nstr = [NSString stringWithUTF8String:text]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6510 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6511 /* 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
|
6512 if(pixmap) |
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 object = pixmap->handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6515 font = pixmap->font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6516 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6517 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
|
6518 /* If we didn't get a font from the pixmap... try the associated object */ |
2423
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
6519 if(!font && ([object isMemberOfClass:[DWRender class]] || [object isKindOfClass:[UIControl class]] |
b4cb136b5222
iOS: Special handling for combined text/image buttons like check and radio
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2422
diff
changeset
|
6520 || [object isKindOfClass:[UILabel class]])) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6521 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6522 font = [object font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6523 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6524 /* 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
|
6525 if(font) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6526 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6527 [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
|
6528 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6529 /* 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
|
6530 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
|
6531 [dict release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6532 /* 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
|
6533 if(width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6534 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6535 *width = size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6536 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6537 if(height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6538 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6539 *height = size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6540 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6541 DW_LOCAL_POOL_OUT; |
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 /* 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
|
6545 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6546 * 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
|
6547 * 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
|
6548 * 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
|
6549 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6550 * y: Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6551 * width: Width of rectangle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6552 * height: Height of rectangle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6553 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6554 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
|
6555 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
|
6556 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
|
6557 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
|
6558 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6559 DW_FUNCTION_INIT; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6560 DWImage *bi = _dw_dest_image(pixmap, handle); |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6561 CGContextRef context = _dw_draw_context(bi, flags & DW_DRAW_NOAA ? NO : YES); |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6562 |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6563 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6564 UIGraphicsPushContext(context); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6565 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6566 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6567 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6568 UIBezierPath* aPath = [UIBezierPath bezierPath]; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6569 int z; |
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6570 |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
6571 [_dw_fg_color set]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6572 |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6573 [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
|
6574 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
|
6575 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6576 [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
|
6577 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6578 [aPath closePath]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6579 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
|
6580 [aPath fill]; |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6581 else |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6582 [aPath stroke]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6583 } |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6584 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6585 UIGraphicsPopContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6586 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6587 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6588 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6589 /* 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
|
6590 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6591 * 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
|
6592 * 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
|
6593 * 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
|
6594 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6595 * y: Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6596 * width: Width of rectangle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6597 * height: Height of rectangle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6598 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6599 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
|
6600 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
|
6601 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
|
6602 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
|
6603 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6604 DW_FUNCTION_INIT; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6605 DWImage *bi = _dw_dest_image(pixmap, handle); |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6606 CGContextRef context = _dw_draw_context(bi, flags & DW_DRAW_NOAA ? NO : YES); |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6607 |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6608 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6609 UIGraphicsPushContext(context); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6610 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6611 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6612 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6613 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
|
6614 |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
6615 [_dw_fg_color set]; |
2372
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 if(flags & DW_DRAW_FILL) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6618 [bp fill]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6619 else |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6620 [bp stroke]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6621 } |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6622 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6623 UIGraphicsPopContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6624 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6625 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6626 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6627 /* 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
|
6628 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6629 * 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
|
6630 * 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
|
6631 * 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
|
6632 * 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
|
6633 * 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
|
6634 * 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
|
6635 * 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
|
6636 * 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
|
6637 * 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
|
6638 * 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
|
6639 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6640 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
|
6641 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
|
6642 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
|
6643 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
|
6644 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6645 DW_FUNCTION_INIT; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6646 DWImage *bi = _dw_dest_image(pixmap, handle); |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6647 CGContextRef context = _dw_draw_context(bi, flags & DW_DRAW_NOAA ? NO : YES); |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6648 |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6649 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6650 UIGraphicsPushContext(context); |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
6651 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6652 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6653 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6654 UIBezierPath* aPath; |
2729
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
6655 |
f9df10c66353
iOS: Pass thread specific colors through thread safety macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2726
diff
changeset
|
6656 [_dw_fg_color set]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6657 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6658 /* 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
|
6659 if(flags & DW_DRAW_FULL) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6660 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
|
6661 else |
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 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
|
6664 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
|
6665 double dx = xorigin - x1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6666 double dy = yorigin - y1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6667 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
|
6668 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6669 /* Prepare to draw */ |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6670 aPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(xorigin, yorigin) |
2440
070337dd4ef7
iOS: Fix dw_draw_arc()... iOS is in raidans not degrees. Thanks wiliz on freenode.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2438
diff
changeset
|
6671 radius:r startAngle:a1 endAngle:a2 clockwise:YES]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6672 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6673 /* 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
|
6674 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
|
6675 [aPath fill]; |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6676 else |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6677 [aPath stroke]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6678 } |
2435
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6679 if(context) |
7d6c8b7f41d9
iOS: Implement graphic context pushing and popping during draw.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2434
diff
changeset
|
6680 UIGraphicsPopContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6681 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6682 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6683 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6684 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6685 * 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
|
6686 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6687 * 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
|
6688 * resource file. |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
6689 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
6690 * 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
|
6691 */ |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6692 DW_FUNCTION_DEFINITION(dw_tree_new, HWND, ULONG cid) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6693 DW_FUNCTION_ADD_PARAM1(cid) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6694 DW_FUNCTION_RETURN(dw_tree_new, HWND) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6695 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6696 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6697 DW_FUNCTION_INIT; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6698 DWTree *tree = [[[DWTree alloc] init] retain]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6699 [tree setTag:cid]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6700 [tree autorelease]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6701 DW_FUNCTION_RETURN_THIS(tree); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6702 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6703 |
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 * 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
|
6706 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6707 * 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
|
6708 * 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
|
6709 * 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
|
6710 * 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
|
6711 * 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
|
6712 * 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
|
6713 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
6714 * 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
|
6715 */ |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6716 DW_FUNCTION_DEFINITION(dw_tree_insert_after, HTREEITEM, HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6717 DW_FUNCTION_ADD_PARAM6(handle, item, title, icon, parent, itemdata) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6718 DW_FUNCTION_RETURN(dw_tree_insert_after, HTREEITEM) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6719 DW_FUNCTION_RESTORE_PARAM6(handle, HWND, item, HTREEITEM, title, char *, icon, HICN, parent, HTREEITEM, itemdata, void *) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6720 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6721 DW_FUNCTION_INIT; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6722 DWTree *tree = handle; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6723 DWTreeItem *treeparent = item ? item : parent; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6724 DWTreeItem *treeitem = [[[DWTreeItem alloc] initWithIcon:icon |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6725 Title:[NSString stringWithUTF8String:(title ? title : "")] |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6726 andData:itemdata] retain]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6727 if(treeparent) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6728 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6729 if(item) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6730 [treeparent insertChildAfter:treeitem]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6731 else |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6732 [treeparent appendChild:treeitem]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6733 } |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6734 else |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6735 [tree insertTreeItem:treeitem]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6736 [treeitem autorelease]; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6737 DW_FUNCTION_RETURN_THIS(treeitem); |
2372
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6741 * 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
|
6742 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6743 * 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
|
6744 * 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
|
6745 * 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
|
6746 * 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
|
6747 * 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
|
6748 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
6749 * 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
|
6750 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6751 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
|
6752 { |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6753 return dw_tree_insert_after(handle, NULL, title, icon, parent, itemdata); |
2372
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6757 * 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
|
6758 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6759 * 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
|
6760 * 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
|
6761 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
6762 * 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
|
6763 */ |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6764 DW_FUNCTION_DEFINITION(dw_tree_get_title, char *, HWND handle, HTREEITEM item) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6765 DW_FUNCTION_ADD_PARAM2(handle, item) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6766 DW_FUNCTION_RETURN(dw_tree_get_title, char *) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6767 DW_FUNCTION_RESTORE_PARAM2(DW_UNUSED(handle), HWND, item, HTREEITEM) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6768 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6769 DW_FUNCTION_INIT; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6770 char *title = NULL; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6771 DWTreeItem *treeitem = item; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6772 if(treeitem) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6773 title = strdup([treeitem.title UTF8String]); |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6774 DW_FUNCTION_RETURN_THIS(title); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6775 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6776 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6777 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6778 * 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
|
6779 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6780 * 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
|
6781 * 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
|
6782 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
6783 * 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
|
6784 */ |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6785 DW_FUNCTION_DEFINITION(dw_tree_get_parent, HTREEITEM, HWND handle, HTREEITEM item) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6786 DW_FUNCTION_ADD_PARAM2(handle, item) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6787 DW_FUNCTION_RETURN(dw_tree_get_parent, HTREEITEM) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6788 DW_FUNCTION_RESTORE_PARAM2(DW_UNUSED(handle), HWND, item, HTREEITEM) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6789 { |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6790 DW_FUNCTION_INIT; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6791 DWTreeItem *treeparent = nil; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6792 DWTreeItem *treeitem = item; |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6793 if(treeitem) |
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6794 treeparent = treeitem.parent; |
2769
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6795 if(treeparent && [treeparent isRoot]) |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6796 treeparent = NULL; |
2765
f734185664cc
iOS: Initial tree view implementation for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2764
diff
changeset
|
6797 DW_FUNCTION_RETURN_THIS(treeparent); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6798 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6799 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6800 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6801 * 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
|
6802 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6803 * 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
|
6804 * 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
|
6805 * 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
|
6806 * 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
|
6807 */ |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6808 DW_FUNCTION_DEFINITION(dw_tree_item_change, void, HWND handle, HTREEITEM item, const char *title, HICN icon) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6809 DW_FUNCTION_ADD_PARAM4(handle, item, title, icon) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6810 DW_FUNCTION_NO_RETURN(dw_tree_item_change) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6811 DW_FUNCTION_RESTORE_PARAM4(DW_UNUSED(handle), HWND, item, HTREEITEM, title, const char *, icon, HICN) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6812 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6813 DW_FUNCTION_INIT; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6814 DWTreeItem *treeitem = item; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6815 if(handle && treeitem) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6816 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6817 [treeitem setIcon:icon]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6818 [treeitem setTitle:[NSString stringWithUTF8String:(title ? title : "")]]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6819 } |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6820 DW_FUNCTION_RETURN_NOTHING; |
2372
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6823 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6824 * 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
|
6825 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6826 * 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
|
6827 * 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
|
6828 * 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
|
6829 */ |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6830 DW_FUNCTION_DEFINITION(dw_tree_item_set_data, void, HWND handle, HTREEITEM item, void *itemdata) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6831 DW_FUNCTION_ADD_PARAM3(handle, item, itemdata) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6832 DW_FUNCTION_NO_RETURN(dw_tree_item_set_data) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6833 DW_FUNCTION_RESTORE_PARAM3(DW_UNUSED(handle), HWND, item, HTREEITEM, itemdata, void *) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6834 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6835 DW_FUNCTION_INIT; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6836 DWTreeItem *treeitem = item; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6837 if(handle && treeitem) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6838 [treeitem setData:itemdata]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6839 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6840 } |
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 * 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
|
6844 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6845 * 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
|
6846 * 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
|
6847 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
6848 * 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
|
6849 */ |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6850 DW_FUNCTION_DEFINITION(dw_tree_item_get_data, void *, HWND handle, HTREEITEM item) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6851 DW_FUNCTION_ADD_PARAM2(handle, item) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6852 DW_FUNCTION_RETURN(dw_tree_item_get_data, void *) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6853 DW_FUNCTION_RESTORE_PARAM2(DW_UNUSED(handle), HWND, item, HTREEITEM) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6854 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6855 DW_FUNCTION_INIT; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6856 void *result = NULL; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6857 DWTreeItem *treeitem = item; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6858 if(handle && treeitem) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6859 result = [treeitem data]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6860 DW_FUNCTION_RETURN_THIS(result); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6861 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6862 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6863 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6864 * 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
|
6865 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6866 * 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
|
6867 * 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
|
6868 */ |
2769
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6869 DW_FUNCTION_DEFINITION(dw_tree_item_select, void, HWND handle, HTREEITEM item) |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6870 DW_FUNCTION_ADD_PARAM2(handle, item) |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6871 DW_FUNCTION_NO_RETURN(dw_tree_item_select) |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6872 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, item, HTREEITEM) |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6873 { |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6874 DW_FUNCTION_INIT; |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6875 DWTree *tree = handle; |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6876 DWTreeItem *treeitem = item; |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6877 |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6878 if(tree && treeitem) |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6879 { |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6880 NSInteger itemIndex = [tree treeView:tree rowForTreeItem:treeitem]; |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6881 if(itemIndex > -1) |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6882 { |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6883 NSIndexPath *ip = [NSIndexPath indexPathForRow:(NSUInteger)itemIndex inSection:0]; |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6884 |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6885 [tree selectRowAtIndexPath:ip |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6886 animated:NO |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6887 scrollPosition:UITableViewScrollPositionNone]; |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6888 } |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6889 } |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6890 DW_FUNCTION_RETURN_NOTHING; |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6891 } |
06f45ee90e0f
iOS: dw_tree_get_parent() should return NULL for the root node.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2767
diff
changeset
|
6892 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6893 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6894 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6895 * 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
|
6896 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6897 * 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
|
6898 */ |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6899 DW_FUNCTION_DEFINITION(dw_tree_clear, void, HWND handle) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6900 DW_FUNCTION_ADD_PARAM1(handle) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6901 DW_FUNCTION_NO_RETURN(dw_tree_clear) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6902 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6903 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6904 DW_FUNCTION_INIT; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6905 DWTree *tree = handle; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6906 [tree clear]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6907 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6908 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6911 * 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
|
6912 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6913 * 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
|
6914 * 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
|
6915 */ |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6916 DW_FUNCTION_DEFINITION(dw_tree_item_expand, void, HWND handle, HTREEITEM item) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6917 DW_FUNCTION_ADD_PARAM2(handle, item) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6918 DW_FUNCTION_NO_RETURN(dw_tree_item_expand) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6919 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, item, HTREEITEM) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6920 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6921 DW_FUNCTION_INIT; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6922 DWTree *tree = handle; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6923 DWTreeItem *treeitem = item; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6924 if(![treeitem expanded]) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6925 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6926 [treeitem setExpanded:YES]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6927 [tree reloadData]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6928 [tree resetSelection:NO]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6929 } |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6930 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6931 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6932 |
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 * 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
|
6935 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6936 * 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
|
6937 * 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
|
6938 */ |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6939 DW_FUNCTION_DEFINITION(dw_tree_item_collapse, void, HWND handle, HTREEITEM item) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6940 DW_FUNCTION_ADD_PARAM2(handle, item) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6941 DW_FUNCTION_NO_RETURN(dw_tree_item_collapse) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6942 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, item, HTREEITEM) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6943 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6944 DW_FUNCTION_INIT; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6945 DWTree *tree = handle; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6946 DWTreeItem *treeitem = item; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6947 if([treeitem expanded]) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6948 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6949 [treeitem setExpanded:NO]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6950 [tree reloadData]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6951 [tree resetSelection:NO]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6952 } |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6953 DW_FUNCTION_RETURN_NOTHING; |
2372
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6956 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6957 * 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
|
6958 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6959 * 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
|
6960 * 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
|
6961 */ |
2767
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6962 DW_FUNCTION_DEFINITION(dw_tree_item_delete, void, HWND handle, HTREEITEM item) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6963 DW_FUNCTION_ADD_PARAM2(handle, item) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6964 DW_FUNCTION_NO_RETURN(dw_tree_item_delete) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6965 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, item, HTREEITEM) |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6966 { |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6967 DW_FUNCTION_INIT; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6968 DWTree *tree = handle; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6969 DWTreeItem *treeitem = item; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6970 [treeitem removeFromParent]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6971 [tree reloadData]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6972 [tree resetSelection:NO]; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6973 DW_FUNCTION_RETURN_NOTHING; |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6974 } |
de144e0fbdf1
iOS: Implement all the tree functions. Fix incorrect display due to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2766
diff
changeset
|
6975 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6976 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6977 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6978 * 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
|
6979 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6980 * 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
|
6981 * resource file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6982 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6983 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
|
6984 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
|
6985 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
|
6986 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
|
6987 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6988 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6989 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
|
6990 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
|
6991 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6992 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6993 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6994 * 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
|
6995 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6996 * 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
|
6997 * 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
|
6998 * 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
|
6999 * 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
|
7000 * 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
|
7001 * (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
|
7002 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7003 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
|
7004 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
|
7005 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
|
7006 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
|
7007 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7008 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7009 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
|
7010 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7011 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7012 [cont setup]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7013 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7014 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
|
7015 { |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
7016 /* Even though we don't have columns on iOS, we save the data... |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
7017 * So we can simulate columns when displaying the data in the list. |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
7018 */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7019 NSString *title = [NSString stringWithUTF8String:titles[z]]; |
2387
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
7020 |
deb2345f4518
iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2385
diff
changeset
|
7021 [cont addColumn:title andType:(int)flags[z]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7022 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7023 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
|
7024 } |
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 * 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
|
7028 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7029 * 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
|
7030 * 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
|
7031 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7032 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
|
7033 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7034 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
|
7035 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7036 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
|
7037 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7038 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7039 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7040 * 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
|
7041 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7042 * 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
|
7043 * 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
|
7044 * 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
|
7045 * 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
|
7046 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7047 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
|
7048 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7049 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
|
7050 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
|
7051 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
|
7052 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7053 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7054 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
|
7055 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7056 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
|
7057 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7058 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
|
7059 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
|
7060 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7061 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
|
7062 [cont setFilesystem:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7063 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7064 if(coltitle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7065 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7066 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
|
7067 free(coltitle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7068 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7069 free(newtitles); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7070 free(newflags); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7071 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7072 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7073 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7074 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7075 * 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
|
7076 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7077 * 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
|
7078 * 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
|
7079 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7080 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
|
7081 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
|
7082 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
|
7083 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
|
7084 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7085 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7086 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7087 [cont addRows:rowcount]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7088 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
|
7089 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7090 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7091 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7092 * 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
|
7093 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7094 * 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
|
7095 * 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
|
7096 * 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
|
7097 * 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
|
7098 * 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
|
7099 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7100 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
|
7101 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
|
7102 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
|
7103 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
|
7104 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7105 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7106 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7107 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
|
7108 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
|
7109 int lastadd = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7110 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7111 /* 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
|
7112 if(pointer) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7113 lastadd = [cont lastAddPoint]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7114 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7115 if(data) |
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 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
|
7118 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7119 icon = *((UIImage **)data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7120 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7121 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
|
7122 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7123 char *str = *((char **)data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7124 text = [ NSString stringWithUTF8String:str ]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7125 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7126 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7127 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7128 char textbuffer[101] = {0}; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7129 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7130 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
|
7131 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7132 ULONG tmp = *((ULONG *)data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7133 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7134 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
|
7135 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7136 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
|
7137 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7138 struct tm curtm; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7139 CDATE cdate = *((CDATE *)data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7140 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7141 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
|
7142 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
|
7143 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
|
7144 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
|
7145 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7146 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
|
7147 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7148 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
|
7149 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7150 struct tm curtm; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7151 CTIME ctime = *((CTIME *)data); |
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 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
|
7154 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
|
7155 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
|
7156 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
|
7157 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7158 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
|
7159 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7160 if(textbuffer[0]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7161 text = [ NSString stringWithUTF8String:textbuffer ]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7162 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7163 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7164 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7165 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
|
7166 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7167 /* 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
|
7168 if([object isMemberOfClass:[UITableViewCell class]]) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7169 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7170 UITableViewCell *cell = object; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7171 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7172 if(icon) |
2417
ccfc4ee9c4a7
iOS: Missed a few other DWContainer fixes in that last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2416
diff
changeset
|
7173 [[cell imageView] setImage:icon]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7174 else |
2417
ccfc4ee9c4a7
iOS: Missed a few other DWContainer fixes in that last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2416
diff
changeset
|
7175 [[cell textLabel] setText:text]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7176 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7177 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
|
7178 [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
|
7179 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7180 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7181 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7182 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7183 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7184 * 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
|
7185 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7186 * 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
|
7187 * 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
|
7188 * 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
|
7189 * 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
|
7190 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7191 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
|
7192 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7193 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
|
7194 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7195 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7196 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7197 * 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
|
7198 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7199 * 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
|
7200 * 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
|
7201 * 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
|
7202 * 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
|
7203 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7204 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
|
7205 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7206 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
|
7207 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7208 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7209 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7210 * 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
|
7211 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7212 * 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
|
7213 * 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
|
7214 * 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
|
7215 * 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
|
7216 * 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
|
7217 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7218 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
|
7219 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7220 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
|
7221 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7222 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7223 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7224 * 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
|
7225 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7226 * 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
|
7227 * 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
|
7228 * 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
|
7229 * 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
|
7230 * 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
|
7231 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7232 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
|
7233 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
|
7234 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
|
7235 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
|
7236 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7237 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7238 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7239 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
|
7240 int lastadd = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7241 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7242 /* 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
|
7243 if(pointer) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7244 lastadd = [cont lastAddPoint]; |
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 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
|
7247 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7248 /* 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
|
7249 if([object isMemberOfClass:[UITableViewCell class]]) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7250 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7251 UITableViewCell *cell = object; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7252 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7253 if(icon) |
2417
ccfc4ee9c4a7
iOS: Missed a few other DWContainer fixes in that last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2416
diff
changeset
|
7254 [[cell imageView] setImage:icon]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7255 if(text) |
2417
ccfc4ee9c4a7
iOS: Missed a few other DWContainer fixes in that last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2416
diff
changeset
|
7256 [[cell textLabel] setText:text]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7257 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7258 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
|
7259 [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
|
7260 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7261 DW_FUNCTION_RETURN_NOTHING; |
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 * 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
|
7266 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7267 * 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
|
7268 * 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
|
7269 * 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
|
7270 * 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
|
7271 * 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
|
7272 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7273 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
|
7274 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7275 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
|
7276 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7277 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7278 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7279 * 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
|
7280 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7281 * 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
|
7282 * column: Zero based column. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7283 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7284 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
|
7285 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
|
7286 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
|
7287 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
|
7288 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7289 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7290 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7291 int rc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7292 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
|
7293 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
|
7294 rc = DW_CFA_BITMAPORICON; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7295 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
|
7296 rc = DW_CFA_STRING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7297 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
|
7298 rc = DW_CFA_ULONG; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7299 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
|
7300 rc = DW_CFA_DATE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7301 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
|
7302 rc = DW_CFA_TIME; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7303 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7304 rc = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7305 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
|
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7309 * 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
|
7310 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7311 * 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
|
7312 * column: Zero based column. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7313 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7314 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
|
7315 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7316 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
|
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7320 * 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
|
7321 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7322 * 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
|
7323 * 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
|
7324 * 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
|
7325 * 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
|
7326 * 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
|
7327 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7328 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
|
7329 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
|
7330 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
|
7331 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
|
7332 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7333 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7334 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7335 [cont setRowBgOdd:oddcolor |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7336 andEven:evencolor]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7337 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7338 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7339 |
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 * 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
|
7342 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7343 * 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
|
7344 * 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
|
7345 * 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
|
7346 */ |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7347 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
|
7348 { |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7349 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7352 * 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
|
7353 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7354 * 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
|
7355 * 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
|
7356 * 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
|
7357 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7358 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
|
7359 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
|
7360 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
|
7361 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
|
7362 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7363 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7364 DWContainer *cont = pointer; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7365 int lastadd = [cont lastAddPoint]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7366 [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
|
7367 DW_FUNCTION_RETURN_NOTHING; |
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 |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7372 * 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
|
7373 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7374 * 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
|
7375 * 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
|
7376 * data: Data pointer. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7377 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7378 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
|
7379 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
|
7380 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
|
7381 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
|
7382 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7383 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7384 DWContainer *cont = pointer; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7385 int lastadd = [cont lastAddPoint]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7386 [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
|
7387 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7388 } |
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 |
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 * 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
|
7393 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7394 * 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
|
7395 * 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
|
7396 * 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
|
7397 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7398 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
|
7399 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
|
7400 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
|
7401 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
|
7402 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7403 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7404 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7405 [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
|
7406 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7407 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7410 * 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
|
7411 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7412 * 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
|
7413 * 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
|
7414 * data: Data pointer. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7415 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7416 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
|
7417 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
|
7418 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
|
7419 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
|
7420 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7421 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7422 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7423 [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
|
7424 DW_FUNCTION_RETURN_NOTHING; |
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 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
|
7429 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7430 * 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
|
7431 * 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
|
7432 * 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
|
7433 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7434 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
|
7435 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
|
7436 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
|
7437 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
|
7438 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7439 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7440 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7441 [cont reloadData]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7442 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7443 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7446 * 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
|
7447 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7448 * 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
|
7449 * 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
|
7450 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7451 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
|
7452 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
|
7453 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
|
7454 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
|
7455 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7456 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7457 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7458 [cont clear]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7459 if(redraw) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7460 [cont reloadData]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7461 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7462 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7463 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7464 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7465 * 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
|
7466 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7467 * 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
|
7468 * 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
|
7469 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7470 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
|
7471 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
|
7472 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
|
7473 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
|
7474 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7475 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7476 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7477 int x; |
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 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
|
7480 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7481 [cont removeRow:0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7482 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7483 [cont reloadData]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7484 DW_FUNCTION_RETURN_NOTHING; |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7487 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7488 * 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
|
7489 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7490 * 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
|
7491 * 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
|
7492 * 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
|
7493 * 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
|
7494 */ |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
7495 DW_FUNCTION_DEFINITION(dw_container_scroll, void, HWND handle, int direction, DW_UNUSED(long rows)) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7496 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
|
7497 DW_FUNCTION_NO_RETURN(dw_container_scroll) |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
7498 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, direction, int, DW_UNUSED(rows), long) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7499 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7500 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7501 DWContainer *cont = handle; |
2388
d84cd4227b21
iOS: Switch to UITableViewDataSource method numberOfRowsInSection:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2387
diff
changeset
|
7502 int rowcount = (int)[cont numberOfRowsInSection:0]; |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
7503 CGPoint offset = [cont contentOffset]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7504 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7505 /* Safety check */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7506 if(rowcount < 1) |
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 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7509 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7510 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7511 switch(direction) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7512 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7513 case DW_SCROLL_TOP: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7514 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7515 offset.y = 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7516 break; |
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 case DW_SCROLL_BOTTOM: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7519 { |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
7520 offset.y = [cont contentSize].height - [cont visibleSize].height; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7521 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7522 } |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
7523 /* TODO: Currently scrolling a full page, need to use row parameter instead */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7524 case DW_SCROLL_UP: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7525 { |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
7526 offset.y -= [cont visibleSize].height; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7527 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7528 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7529 case DW_SCROLL_DOWN: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7530 { |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
7531 offset.y += [cont visibleSize].height; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7532 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7533 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7534 } |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7535 if(offset.y < 0) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7536 offset.y = 0; |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
7537 [cont setContentOffset:offset]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7538 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7539 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7540 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7541 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7542 * 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
|
7543 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7544 * 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
|
7545 * 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
|
7546 * 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
|
7547 * 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
|
7548 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7549 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
|
7550 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
|
7551 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
|
7552 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
|
7553 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7554 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7555 DWContainer *cont = handle; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
7556 NSArray *selected = [cont indexPathsForSelectedRows]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
7557 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
|
7558 void *retval = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7559 |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
7560 if(result) |
2372
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 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
|
7563 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
|
7564 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7565 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
7566 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
|
7567 if(temp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7568 retval = strdup(temp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7569 } |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
7570 [cont setLastQueryPoint:1]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7571 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7572 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
|
7573 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7574 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7575 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7576 * 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
|
7577 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7578 * 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
|
7579 * 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
|
7580 * 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
|
7581 * 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
|
7582 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7583 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
|
7584 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
|
7585 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
|
7586 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
|
7587 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7588 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7589 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7590 int lastQueryPoint = [cont lastQueryPoint]; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
7591 NSArray *selected = [cont indexPathsForSelectedRows]; |
2429
89f4aba2e387
iOS: Put back missing tree selection code, since it is apparently also used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2428
diff
changeset
|
7592 NSIndexPath *result = lastQueryPoint < [selected count] ? [selected objectAtIndex:lastQueryPoint] : nil; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7593 void *retval = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7594 |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
7595 if(result) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7596 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7597 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
|
7598 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
|
7599 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7600 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
7601 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
|
7602 if(temp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7603 retval = strdup(temp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7604 } |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
7605 [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
|
7606 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7607 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
|
7608 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7609 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7610 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7611 * 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
|
7612 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7613 * 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
|
7614 * 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
|
7615 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7616 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
|
7617 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
|
7618 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
|
7619 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
|
7620 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7621 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7622 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7623 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7624 char *thistext; |
2388
d84cd4227b21
iOS: Switch to UITableViewDataSource method numberOfRowsInSection:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2387
diff
changeset
|
7625 int x, count = (int)[cont numberOfRowsInSection:0]; |
2372
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 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
|
7628 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7629 thistext = [cont getRowTitle:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7630 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7631 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
|
7632 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7633 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
|
7634 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7635 [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
|
7636 animated:NO |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7637 scrollPosition:UITableViewScrollPositionNone]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7638 x=count; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7639 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7640 } |
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 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7643 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7644 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7647 * 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
|
7648 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7649 * 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
|
7650 * 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
|
7651 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7652 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
|
7653 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
|
7654 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
|
7655 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
|
7656 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7657 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7658 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7659 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7660 void *thisdata; |
2388
d84cd4227b21
iOS: Switch to UITableViewDataSource method numberOfRowsInSection:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2387
diff
changeset
|
7661 int x, count = (int)[cont numberOfRowsInSection:0]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7662 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7663 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
|
7664 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7665 thisdata = [cont getRowData:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7666 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7667 if(thisdata == data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7668 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7669 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
|
7670 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7671 [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
|
7672 animated:NO |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7673 scrollPosition:UITableViewScrollPositionNone]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7674 x=count; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7675 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7676 } |
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 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7679 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7680 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7681 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7682 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7683 * 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
|
7684 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7685 * 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
|
7686 * 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
|
7687 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7688 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
|
7689 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
|
7690 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
|
7691 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
|
7692 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7693 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7694 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7695 char *thistext; |
2388
d84cd4227b21
iOS: Switch to UITableViewDataSource method numberOfRowsInSection:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2387
diff
changeset
|
7696 int x, count = (int)[cont numberOfRowsInSection:0]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7697 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7698 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
|
7699 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7700 thistext = [cont getRowTitle:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7701 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7702 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
|
7703 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7704 [cont removeRow:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7705 [cont reloadData]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7706 x=count; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7707 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7708 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7709 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7710 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7711 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7712 |
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 * 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
|
7715 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7716 * 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
|
7717 * data: Data specified. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7718 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7719 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
|
7720 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
|
7721 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
|
7722 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
|
7723 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7724 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7725 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7726 void *thisdata; |
2388
d84cd4227b21
iOS: Switch to UITableViewDataSource method numberOfRowsInSection:
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2387
diff
changeset
|
7727 int x, count = (int)[cont numberOfRowsInSection:0]; |
2372
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 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
|
7730 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7731 thisdata = [cont getRowData:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7732 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7733 if(thisdata == data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7734 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7735 [cont removeRow:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7736 [cont reloadData]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7737 x=count; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7738 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7739 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7740 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7741 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7742 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7743 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7744 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7745 * 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
|
7746 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7747 * 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
|
7748 */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
7749 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
|
7750 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
7751 /* 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
|
7752 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7753 |
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 * 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
|
7756 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7757 * 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
|
7758 * 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
|
7759 * 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
|
7760 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7761 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
|
7762 { |
2711
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
7763 /* Taskbar unsupported on iOS */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7764 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7765 |
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 * 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
|
7768 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7769 * 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
|
7770 * 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
|
7771 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7772 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
|
7773 { |
2711
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
7774 /* Taskbar unsupported on iOS */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7775 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7776 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7777 /* Internal function to keep HICNs from getting too big */ |
2705
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7778 UIImage *_dw_icon_resize(UIImage *image) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7779 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7780 if(image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7781 { |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
7782 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
|
7783 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
|
7784 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7785 if(size.width > 24) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7786 size.width = 24; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7787 if(size.height > 24) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7788 size.height = 24; |
2705
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7789 // Pass 0.0 to use the current device's pixel scaling factor (and thus account for Retina resolution). |
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7790 // Pass 1.0 to force exact pixel size. |
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7791 UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); |
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7792 [image drawInRect:CGRectMake(0, 0, size.width, size.height)]; |
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7793 UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); |
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7794 UIGraphicsEndImageContext(); |
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7795 return newImage; |
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7796 } |
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7797 } |
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7798 return image; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7799 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7800 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7801 /* 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
|
7802 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
|
7803 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7804 NSBundle *bundle = [NSBundle mainBundle]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7805 NSString *respath = [bundle resourcePath]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7806 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
|
7807 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
|
7808 return image; |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7811 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7812 * 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
|
7813 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7814 * 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
|
7815 * 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
|
7816 * 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
|
7817 * to an embedded XPM. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7818 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7819 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
|
7820 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7821 UIImage *image = _dw_icon_load(resid); |
2705
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7822 return _dw_icon_resize(image); |
2372
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 * 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
|
7827 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7828 * 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
|
7829 * 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
|
7830 * (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
|
7831 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7832 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
|
7833 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7834 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
|
7835 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7836 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
|
7837 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
|
7838 if(!image && ext) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7839 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7840 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
|
7841 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
|
7842 } |
2705
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7843 return _dw_icon_resize(image); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7844 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7847 * 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
|
7848 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7849 * 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
|
7850 * 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
|
7851 * (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
|
7852 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7853 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
|
7854 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7855 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
|
7856 UIImage *image = [[UIImage alloc] initWithData:thisdata]; |
2705
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
7857 return _dw_icon_resize(image); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7858 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7859 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7860 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7861 * 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
|
7862 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7863 * 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
|
7864 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7865 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
|
7866 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7867 UIImage *image = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7868 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7869 [image release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7870 DW_LOCAL_POOL_OUT; |
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 * 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
|
7875 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7876 * 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
|
7877 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7878 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
|
7879 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7880 /* 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
|
7881 * 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
|
7882 * 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
|
7883 * similar behavior. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7884 */ |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
7885 DWMDI *mdi = [[[DWMDI alloc] init] retain]; |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
7886 [mdi setTag:cid]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7887 return mdi; |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7890 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7891 * 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
|
7892 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7893 * 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
|
7894 * 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
|
7895 * 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
|
7896 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7897 * 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
|
7898 */ |
2641
608598b9fed9
iOS: UISplitViewController may not be the right way to implement DWSplitBar.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2640
diff
changeset
|
7899 DW_FUNCTION_DEFINITION(dw_splitbar_new, HWND, 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
|
7900 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
|
7901 DW_FUNCTION_RETURN(dw_splitbar_new, HWND) |
2641
608598b9fed9
iOS: UISplitViewController may not be the right way to implement DWSplitBar.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2640
diff
changeset
|
7902 DW_FUNCTION_RESTORE_PARAM4(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
|
7903 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7904 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7905 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
|
7906 DWSplitBar *split = [[DWSplitBar alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7907 dw_box_pack_start(tmpbox, topleft, 0, 0, TRUE, TRUE, 0); |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
7908 [split setTopLeft:tmpbox]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7909 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
|
7910 dw_box_pack_start(tmpbox, bottomright, 0, 0, TRUE, TRUE, 0); |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
7911 [split setBottomRight:tmpbox]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7912 [split setPercent:50.0]; |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
7913 [split setType:type]; |
2641
608598b9fed9
iOS: UISplitViewController may not be the right way to implement DWSplitBar.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2640
diff
changeset
|
7914 [split setTag:cid]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7915 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
|
7916 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7917 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7918 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7919 * 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
|
7920 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7921 * 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
|
7922 * 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
|
7923 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7924 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
|
7925 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
|
7926 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
|
7927 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
|
7928 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7929 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7930 DWSplitBar *split = handle; |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
7931 [split setPercent:percent]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7932 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7933 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7934 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7935 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7936 * 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
|
7937 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7938 * 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
|
7939 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7940 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
|
7941 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7942 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
|
7943 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
|
7944 |
2646
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
7945 if(split) |
42bc7ddd6751
iOS: Reimplement DWSplitBar as a UIView subclass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2641
diff
changeset
|
7946 retval = [split percent]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7947 return retval; |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7950 /* 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
|
7951 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
|
7952 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7953 UIFont *font = DWDefaultFont; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7954 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7955 if(fontname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7956 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7957 char *name = strchr(fontname, '.'); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7958 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7959 if(name && (name++)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7960 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7961 UIFontDescriptorSymbolicTraits traits = 0; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7962 UIFontDescriptor* fd; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7963 int size = atoi(fontname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7964 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
|
7965 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
|
7966 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
|
7967 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
|
7968 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7969 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
|
7970 strncpy(newname, name, len); |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7971 |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7972 if(Bold) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7973 traits |= UIFontDescriptorTraitBold; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7974 if(Italic) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7975 traits |= UIFontDescriptorTraitItalic; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7976 |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7977 fd = [UIFontDescriptor |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7978 fontDescriptorWithFontAttributes:@{UIFontDescriptorFamilyAttribute:[NSString stringWithUTF8String:newname], |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7979 UIFontDescriptorTraitsAttribute: @{UIFontSymbolicTrait:[NSNumber numberWithInteger:traits]}}]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7980 NSArray* matches = [fd matchingFontDescriptorsWithMandatoryKeys: |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7981 [NSSet setWithObjects:UIFontDescriptorFamilyAttribute, UIFontDescriptorTraitsAttribute, nil]]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7982 if(matches.count != 0) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
7983 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
|
7984 } |
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 return font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7987 } |
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 * 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
|
7991 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7992 * 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
|
7993 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7994 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
|
7995 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
|
7996 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
|
7997 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
|
7998 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7999 DW_FUNCTION_INIT; |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
8000 UIImageView *bitmap = [[[UIImageView alloc] init] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8001 [bitmap setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8002 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
|
8003 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8004 |
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 * 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
|
8007 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8008 * 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
|
8009 * 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
|
8010 * 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
|
8011 * 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
|
8012 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8013 * 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
|
8014 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8015 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
|
8016 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
8017 HPIXMAP pixmap = NULL; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
8018 |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
8019 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
|
8020 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
8021 pixmap->width = width; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
8022 pixmap->height = height; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
8023 pixmap->handle = handle; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
8024 pixmap->image = [[[DWImage alloc] initWithSize:CGSizeMake(width,height)] retain]; |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
8025 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8026 return pixmap; |
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 |
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 * 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
|
8031 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8032 * 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
|
8033 * 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
|
8034 * 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
|
8035 * (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
|
8036 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8037 * 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
|
8038 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8039 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
|
8040 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8041 HPIXMAP pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8042 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8043 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
|
8044 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8045 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
|
8046 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8047 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8048 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8049 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8050 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
|
8051 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
|
8052 if(!tmpimage && ext) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8053 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8054 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
|
8055 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
|
8056 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8057 if(!tmpimage) |
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 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8060 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8061 } |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
8062 pixmap->width = [tmpimage size].width; |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
8063 pixmap->height = [tmpimage size].height; |
2447
8723c01fb87e
iOS: Fix bug in dw_pixmap_new_from_file(). Resources go into the app
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2445
diff
changeset
|
8064 pixmap->image = [[DWImage alloc] initWithUIImage:tmpimage]; |
8723c01fb87e
iOS: Fix bug in dw_pixmap_new_from_file(). Resources go into the app
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2445
diff
changeset
|
8065 pixmap->handle = handle; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8066 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8067 return pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8068 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8071 * 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
|
8072 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8073 * 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
|
8074 * 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
|
8075 * (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
|
8076 * le: length of data |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8077 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8078 * 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
|
8079 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8080 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
|
8081 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8082 HPIXMAP pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8083 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8084 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8085 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
|
8086 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8087 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8088 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8089 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8090 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
|
8091 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
|
8092 if(!tmpimage) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8093 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8094 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8095 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8096 } |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
8097 pixmap->width = [tmpimage size].width; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
8098 pixmap->height = [tmpimage size].height; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
8099 pixmap->image = [[DWImage alloc] initWithUIImage:tmpimage]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8100 pixmap->handle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8101 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8102 return pixmap; |
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 |
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 * 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
|
8107 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8108 * 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
|
8109 * dw_pixmap_new.. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8110 * color: transparent color |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8111 * 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
|
8112 * is handled automatically |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8113 */ |
2711
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
8114 void API dw_pixmap_set_transparent_color(HPIXMAP pixmap, ULONG color) |
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
8115 { |
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
8116 /* Don't do anything, all images support transparency on iOS */ |
2372
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 * 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
|
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 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
|
8123 * 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
|
8124 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8125 * 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
|
8126 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8127 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
|
8128 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8129 HPIXMAP pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8130 DW_LOCAL_POOL_IN; |
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 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
|
8133 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8134 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8135 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8136 } |
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 NSBundle *bundle = [NSBundle mainBundle]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8139 NSString *respath = [bundle resourcePath]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8140 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
|
8141 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
|
8142 |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
8143 if(tmpimage) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8144 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
8145 pixmap->width = [tmpimage size].width; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
8146 pixmap->height = [tmpimage size].height; |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
8147 pixmap->image = [[DWImage alloc] initWithUIImage:tmpimage]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8148 pixmap->handle = handle; |
2412
3b59cbd26fab
iOS/Mac: Fix a minor memory leak in dw_pixmap_grab().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2411
diff
changeset
|
8149 DW_LOCAL_POOL_OUT; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8150 return pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8151 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8152 free(pixmap); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8153 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8154 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8155 } |
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 * 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
|
8159 * 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
|
8160 * 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
|
8161 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8162 * 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
|
8163 * 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
|
8164 * 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
|
8165 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8166 * 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
|
8167 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8168 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
|
8169 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8170 if(pixmap) |
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 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
|
8173 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8174 if(font) |
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 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8177 UIFont *oldfont = pixmap->font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8178 [font retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8179 pixmap->font = font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8180 if(oldfont) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8181 [oldfont release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8182 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8183 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8184 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8185 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8186 return DW_ERROR_GENERAL; |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8190 * Destroys an allocated pixmap. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8191 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8192 * 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
|
8193 * dw_pixmap_new.. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8194 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8195 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
|
8196 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8197 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8198 { |
2434
404d9e9f1f08
iOS: Second attempt at a DWImage class that will actually work....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2433
diff
changeset
|
8199 DWImage *image = (DWImage *)pixmap->image; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8200 UIFont *font = pixmap->font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8201 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8202 [image release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8203 [font release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8204 free(pixmap); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8205 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8206 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8207 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8208 |
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 * 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
|
8211 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8212 * dest: Destination window handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8213 * 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
|
8214 * 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
|
8215 * 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
|
8216 * 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
|
8217 * 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
|
8218 * src: Source window handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8219 * 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
|
8220 * 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
|
8221 * 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
|
8222 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8223 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
|
8224 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8225 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
|
8226 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8229 * 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
|
8230 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8231 * dest: Destination window handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8232 * 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
|
8233 * 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
|
8234 * 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
|
8235 * 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
|
8236 * 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
|
8237 * src: Source window handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8238 * 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
|
8239 * 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
|
8240 * 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
|
8241 * 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
|
8242 * 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
|
8243 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8244 * 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
|
8245 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8246 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
|
8247 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8248 DWBitBlt *bltinfo; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8249 NSValue* bi; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8250 DW_LOCAL_POOL_IN; |
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 /* Sanity checks */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8253 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
|
8254 ((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
|
8255 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8256 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8257 return DW_ERROR_GENERAL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8258 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8259 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8260 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
|
8261 bi = [NSValue valueWithPointer:bltinfo]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8262 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8263 /* Fill in the information */ |
2436
ab36fbb50fe5
iOS: Fixes to get cachedImage functionality working.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2435
diff
changeset
|
8264 bltinfo->dest = _dw_dest_image(destp, dest); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8265 bltinfo->src = src; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8266 bltinfo->xdest = xdest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8267 bltinfo->ydest = ydest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8268 bltinfo->width = width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8269 bltinfo->height = height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8270 bltinfo->xsrc = xsrc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8271 bltinfo->ysrc = ysrc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8272 bltinfo->srcwidth = srcwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8273 bltinfo->srcheight = srcheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8274 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8275 if(srcp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8276 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8277 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
|
8278 [object retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8279 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8280 [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
|
8281 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8282 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8283 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8286 * 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
|
8287 * 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
|
8288 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8289 * 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
|
8290 * 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
|
8291 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8292 DW_FUNCTION_DEFINITION(dw_calendar_new, HWND, ULONG cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8293 DW_FUNCTION_ADD_PARAM1(cid) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8294 DW_FUNCTION_RETURN(dw_calendar_new, HWND) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8295 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8296 { |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
8297 DWCalendar *calendar = [[[DWCalendar alloc] init] retain]; |
2583
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
8298 if (@available(iOS 14.0, *)) { |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
8299 [calendar setPreferredDatePickerStyle:UIDatePickerStyleInline]; |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
8300 } else { |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
8301 // We really want the iOS 14 style to match the other platforms... |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
8302 // but just leave it the default spinner style on 13 and earlier. |
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
8303 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8304 [calendar setDatePickerMode:UIDatePickerModeDate]; |
2583
1d2f5c4eccc5
iOS: Implement keyboard handling for iOS 13.4 and later.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
8305 [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
|
8306 [calendar setTag:cid]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8307 DW_FUNCTION_RETURN_THIS(calendar); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8308 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8309 |
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 * 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
|
8312 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8313 * 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
|
8314 * year... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8315 */ |
2400
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
8316 DW_FUNCTION_DEFINITION(dw_calendar_set_date, void, HWND handle, unsigned int year, unsigned int month, unsigned int day) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
8317 DW_FUNCTION_ADD_PARAM4(handle, year, month, day) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
8318 DW_FUNCTION_NO_RETURN(dw_calendar_set_date) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
8319 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, year, unsigned int, month, unsigned int, day, unsigned int) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8320 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8321 DWCalendar *calendar = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8322 NSDate *date; |
2419
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
8323 char buffer[101] = {0}; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8324 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8325 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
|
8326 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8327 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
|
8328 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
|
8329 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8330 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
|
8331 [calendar setDate:date]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8332 [date release]; |
2400
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
8333 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8334 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8337 * 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
|
8338 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8339 * 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
|
8340 */ |
2400
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
8341 DW_FUNCTION_DEFINITION(dw_calendar_get_date, void, HWND handle, unsigned int *year, unsigned int *month, unsigned int *day) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
8342 DW_FUNCTION_ADD_PARAM4(handle, year, month, day) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
8343 DW_FUNCTION_NO_RETURN(dw_calendar_get_date) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
8344 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, year, unsigned int *, month, unsigned int *, day, unsigned int *) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8345 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8346 DWCalendar *calendar = handle; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8347 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
|
8348 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
|
8349 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
|
8350 *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
|
8351 *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
|
8352 *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
|
8353 [mycalendar release]; |
2400
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
8354 DW_FUNCTION_RETURN_NOTHING; |
2372
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 * 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
|
8359 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8360 * 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
|
8361 * 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
|
8362 */ |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8363 DW_FUNCTION_DEFINITION(dw_html_action, void, HWND handle, int action) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8364 DW_FUNCTION_ADD_PARAM2(handle, action) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8365 DW_FUNCTION_NO_RETURN(dw_html_action) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8366 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, action, int) |
2372
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 DWWebView *html = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8369 switch(action) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8370 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8371 case DW_HTML_GOBACK: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8372 [html goBack]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8373 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8374 case DW_HTML_GOFORWARD: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8375 [html goForward]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8376 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8377 case DW_HTML_GOHOME: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8378 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
|
8379 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8380 case DW_HTML_SEARCH: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8381 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8382 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
|
8383 [html reload]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8384 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8385 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
|
8386 [html stopLoading]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8387 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8388 case DW_HTML_PRINT: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8389 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8390 } |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8391 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8392 } |
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 * 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
|
8396 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8397 * 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
|
8398 * 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
|
8399 * be rendered. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8400 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8401 * 0 on success. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8402 */ |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8403 DW_FUNCTION_DEFINITION(dw_html_raw, int, HWND handle, const char *string) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8404 DW_FUNCTION_ADD_PARAM2(handle, string) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8405 DW_FUNCTION_RETURN(dw_html_raw, int) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8406 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, string, const char *) |
2372
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 DWWebView *html = handle; |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8409 int retval = DW_ERROR_NONE; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8410 [html loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil]; |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8411 DW_FUNCTION_RETURN_THIS(retval); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8412 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8415 * 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
|
8416 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8417 * 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
|
8418 * 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
|
8419 * 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
|
8420 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8421 * 0 on success. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8422 */ |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8423 DW_FUNCTION_DEFINITION(dw_html_url, int, HWND handle, const char *url) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8424 DW_FUNCTION_ADD_PARAM2(handle, url) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8425 DW_FUNCTION_RETURN(dw_html_url, int) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8426 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, url, const char *) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8427 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8428 DWWebView *html = handle; |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8429 int retval = DW_ERROR_NONE; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8430 [html loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]]; |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8431 DW_FUNCTION_RETURN_THIS(retval); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8432 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8433 |
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 * 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
|
8436 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8437 * 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
|
8438 * 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
|
8439 * 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
|
8440 * 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
|
8441 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8442 * 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
|
8443 */ |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8444 DW_FUNCTION_DEFINITION(dw_html_javascript_run, int, HWND handle, const char *script, void *scriptdata) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8445 DW_FUNCTION_ADD_PARAM3(handle, script, scriptdata) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8446 DW_FUNCTION_RETURN(dw_html_javascript_run, int) |
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8447 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, script, const char *, scriptdata, void *) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8448 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8449 DWWebView *html = handle; |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8450 int retval = DW_ERROR_NONE; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8451 DW_LOCAL_POOL_IN; |
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 [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
|
8454 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8455 void *params[2] = { result, scriptdata }; |
2622
07c504257e42
iOS: Switch to using internal event message constants.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2616
diff
changeset
|
8456 _dw_event_handler(html, (id)params, _DW_EVENT_HTML_RESULT); |
2372
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 DW_LOCAL_POOL_OUT; |
2404
d4a044d24529
iOS: Fix crashes with full dwtest run. More thread safety.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2402
diff
changeset
|
8459 DW_FUNCTION_RETURN_THIS(retval); |
2372
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 |
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 * 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
|
8464 * 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
|
8465 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8466 * 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
|
8467 * 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
|
8468 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8469 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
|
8470 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
|
8471 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
|
8472 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
|
8473 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8474 DW_FUNCTION_INIT; |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
8475 DWWebView *web = [[[DWWebView alloc] init] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8476 web.navigationDelegate = web; |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
8477 [web setTag:cid]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8478 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
|
8479 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8482 * 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
|
8483 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8484 * 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
|
8485 * 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
|
8486 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8487 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
|
8488 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8489 if(x) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8490 { |
2606
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
8491 *x = (long)_dw_event_point.x; |
2372
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 if(y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8494 { |
2606
6c30fcc79402
iOS: Implement context menus on DWRender widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2605
diff
changeset
|
8495 *y = (long)_dw_event_point.y; |
2372
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 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8498 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8499 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8500 * 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
|
8501 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8502 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8503 * y: Y coordinate. |
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 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
|
8506 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8507 /* 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
|
8508 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8509 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8510 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8511 * 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
|
8512 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8513 * 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
|
8514 * resource file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8515 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8516 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
|
8517 { |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8518 DWMenu *menu = [[[DWMenu alloc] initWithTag:cid] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8519 return menu; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8520 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8523 * 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
|
8524 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8525 * 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
|
8526 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8527 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
|
8528 { |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
8529 DWWindow *window = location; |
2577
6fdab466d7a2
Android: Fix notebook page change event page always being 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2570
diff
changeset
|
8530 DWMenu *menu = [[[DWMenu alloc] initWithTag:0] retain]; |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
8531 |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
8532 [window setMenu:menu]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
8533 return menu; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8534 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8535 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8536 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8537 * 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
|
8538 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8539 * 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
|
8540 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8541 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
|
8542 { |
2615
ac51cbdcfbe5
dw_menu_destroy() should zero out the handle passed, GTK does this already.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2612
diff
changeset
|
8543 if(menu) |
ac51cbdcfbe5
dw_menu_destroy() should zero out the handle passed, GTK does this already.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2612
diff
changeset
|
8544 { |
ac51cbdcfbe5
dw_menu_destroy() should zero out the handle passed, GTK does this already.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2612
diff
changeset
|
8545 DWMenu *thismenu = *menu; |
ac51cbdcfbe5
dw_menu_destroy() should zero out the handle passed, GTK does this already.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2612
diff
changeset
|
8546 DW_LOCAL_POOL_IN; |
ac51cbdcfbe5
dw_menu_destroy() should zero out the handle passed, GTK does this already.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2612
diff
changeset
|
8547 [thismenu release]; |
ac51cbdcfbe5
dw_menu_destroy() should zero out the handle passed, GTK does this already.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2612
diff
changeset
|
8548 DW_LOCAL_POOL_OUT; |
ac51cbdcfbe5
dw_menu_destroy() should zero out the handle passed, GTK does this already.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2612
diff
changeset
|
8549 *menu = NULL; |
ac51cbdcfbe5
dw_menu_destroy() should zero out the handle passed, GTK does this already.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2612
diff
changeset
|
8550 } |
2372
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8553 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8554 * 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
|
8555 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8556 * 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
|
8557 * 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
|
8558 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8559 * y: Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8560 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8561 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
|
8562 { |
2616
a256caa5034c
iOS: Fix a context menu related crash by removing autorelease from DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2615
diff
changeset
|
8563 if(menu) |
a256caa5034c
iOS: Fix a context menu related crash by removing autorelease from DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2615
diff
changeset
|
8564 { |
a256caa5034c
iOS: Fix a context menu related crash by removing autorelease from DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2615
diff
changeset
|
8565 DWMenu *thismenu = (DWMenu *)*menu; |
a256caa5034c
iOS: Fix a context menu related crash by removing autorelease from DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2615
diff
changeset
|
8566 id object = parent; |
a256caa5034c
iOS: Fix a context menu related crash by removing autorelease from DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2615
diff
changeset
|
8567 DWWindow *window = [object isMemberOfClass:[DWWindow class]] ? object : (DWWindow *)[object window]; |
a256caa5034c
iOS: Fix a context menu related crash by removing autorelease from DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2615
diff
changeset
|
8568 [window setPopupMenu:thismenu]; |
a256caa5034c
iOS: Fix a context menu related crash by removing autorelease from DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2615
diff
changeset
|
8569 *menu = nil; |
a256caa5034c
iOS: Fix a context menu related crash by removing autorelease from DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2615
diff
changeset
|
8570 } |
2372
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 |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
8573 char _dw_removetilde(char *dest, const char *src) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8574 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8575 int z, cur=0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8576 char accel = '\0'; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8577 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8578 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
|
8579 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8580 if(src[z] != '~') |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8581 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8582 dest[cur] = src[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8583 cur++; |
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 else |
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 accel = src[z+1]; |
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 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8590 dest[cur] = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8591 return accel; |
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 |
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 * 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
|
8596 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8597 * 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
|
8598 * 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
|
8599 * 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
|
8600 * 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
|
8601 * 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
|
8602 * 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
|
8603 * 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
|
8604 * 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
|
8605 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8606 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
|
8607 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8608 DWMenu *menu = menux; |
2604
4671ac4ad3c6
iOS: Had to switch from UIKeyCommand to UIAction for DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2603
diff
changeset
|
8609 __block DWMenuItem *item = nil; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8610 if(!title || strlen(title) == 0) |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8611 [menu addItem:[[NSNull alloc] init]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8612 else |
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 char accel[2]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8615 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
|
8616 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
|
8617 |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
8618 accel[0] = _dw_removetilde(newtitle, title); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8619 accel[1] = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8620 |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8621 nstr = [NSString stringWithUTF8String:newtitle]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8622 free(newtitle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8623 |
2616
a256caa5034c
iOS: Fix a context menu related crash by removing autorelease from DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2615
diff
changeset
|
8624 item = [DWMenuItem actionWithTitle:nstr image:nil identifier:nil |
2604
4671ac4ad3c6
iOS: Had to switch from UIKeyCommand to UIAction for DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2603
diff
changeset
|
8625 handler:^(__kindof UIAction * _Nonnull action) { |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8626 if(check) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8627 { |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8628 UIMenuElementState state = [item state] == UIMenuElementStateOn ? UIMenuElementStateOff : UIMenuElementStateOn; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8629 [item setState:state]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8630 } |
2604
4671ac4ad3c6
iOS: Had to switch from UIKeyCommand to UIAction for DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2603
diff
changeset
|
8631 [DWObj menuHandler:item]; |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8632 if(check) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8633 { |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8634 for(id obj in _dw_toplevel_windows) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8635 [obj updateMenu]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8636 } |
2616
a256caa5034c
iOS: Fix a context menu related crash by removing autorelease from DWMenuItem.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2615
diff
changeset
|
8637 }]; |
2602
cc5013e626f7
iOS: Code cleanup, make sure menu items are enabled on creation.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2601
diff
changeset
|
8638 /* Don't set the tag if the ID is 0 or -1 */ |
2601
3201f9e9067b
iOS: Actually implement disabled menu items using UIMenuElementAttributesDisabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2600
diff
changeset
|
8639 if(itemid != DW_MENU_AUTO && itemid != DW_MENU_POPUP) |
3201f9e9067b
iOS: Actually implement disabled menu items using UIMenuElementAttributesDisabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2600
diff
changeset
|
8640 [item setTag:itemid]; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8641 [menu addItem:item]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8642 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8643 if(check) |
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 [item setCheck:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8646 if(flags & 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
|
8647 [item setState:UIMenuElementStateOn]; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8648 } |
2602
cc5013e626f7
iOS: Code cleanup, make sure menu items are enabled on creation.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2601
diff
changeset
|
8649 [item setEnabled:(flags & DW_MIS_DISABLED ? NO : YES)]; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8650 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8651 if(submenux) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8652 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8653 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
|
8654 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8655 [submenu setTitle:nstr]; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8656 [item setSubmenu:submenu]; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8657 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8658 return item; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8659 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8660 return item; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8661 } |
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 * 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
|
8665 * 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
|
8666 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8667 * 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
|
8668 * id: Menuitem id. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8669 * 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
|
8670 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8671 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
|
8672 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8673 id menu = menux; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8674 DWMenuItem *menuitem = [menu childWithTag:itemid]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8675 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8676 if(menuitem != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8677 { |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8678 UIMenuElementState newstate = check ? UIMenuElementStateOn : UIMenuElementStateOff; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8679 |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8680 /* Only force the menus to repopulate if something changed */ |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8681 if(newstate != [menuitem state]) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8682 { |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8683 [menuitem setState:newstate]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8684 for(id obj in _dw_toplevel_windows) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8685 [obj updateMenu]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8686 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8687 } |
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 * 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
|
8692 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8693 * 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
|
8694 * id: Menuitem id. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8695 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8696 * 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
|
8697 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8698 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
|
8699 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8700 id menu = menux; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8701 DWMenuItem *menuitem = [menu childWithTag:itemid]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8702 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8703 if(menuitem != nil) |
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 [menu removeItem:menuitem]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8706 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8707 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8708 return DW_ERROR_UNKNOWN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8709 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8712 * 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
|
8713 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8714 * 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
|
8715 * id: Menuitem id. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8716 * 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
|
8717 * 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
|
8718 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8719 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
|
8720 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8721 id menu = menux; |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
8722 DWMenuItem *menuitem = [menu childWithTag:itemid]; |
2372
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 if(menuitem != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8725 { |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8726 UIMenuElementState oldstate = [menuitem state]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8727 BOOL oldenabled = [menuitem enabled]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8728 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8729 if(state & 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
|
8730 [menuitem setState:UIMenuElementStateOn]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8731 else if(state & 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
|
8732 [menuitem setState:UIMenuElementStateOff]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8733 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
|
8734 [menuitem setEnabled:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8735 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
|
8736 [menuitem setEnabled:NO]; |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8737 |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8738 /* Only force the menus to repopulate if something changed */ |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8739 if(oldstate != [menuitem state] || oldenabled != [menuitem enabled]) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8740 { |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8741 for(id obj in _dw_toplevel_windows) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
8742 [obj updateMenu]; |
2372
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 } |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8747 /* Gets the notebook page from associated ID */ |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
8748 DWNotebookPage *_dw_notepage_from_id(DWNotebook *notebook, unsigned long pageid) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8749 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8750 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
|
8751 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
|
8752 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8753 if([notepage pageid] == pageid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8754 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8755 return notepage; |
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 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8758 return nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8759 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8760 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8761 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8762 * 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
|
8763 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8764 * 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
|
8765 * resource file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8766 */ |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
8767 DW_FUNCTION_DEFINITION(dw_notebook_new, HWND, ULONG cid, DW_UNUSED(int top)) |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8768 DW_FUNCTION_ADD_PARAM2(cid, top) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8769 DW_FUNCTION_RETURN(dw_notebook_new, HWND) |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
8770 DW_FUNCTION_RESTORE_PARAM2(cid, ULONG, DW_UNUSED(top), int) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8771 { |
2405
38c17a19e00d
iOS: Add adjustment for the statusbar so it isn't covered up by our windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2404
diff
changeset
|
8772 DWNotebook *notebook = [[[DWNotebook alloc] init] retain]; |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8773 [[notebook tabs] addTarget:notebook |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8774 action:@selector(pageChanged:) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8775 forControlEvents:UIControlEventValueChanged]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8776 [notebook setTag:cid]; |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8777 DW_FUNCTION_RETURN_THIS(notebook); |
2372
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8780 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8781 * 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
|
8782 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8783 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8784 * 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
|
8785 * 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
|
8786 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8787 DW_FUNCTION_DEFINITION(dw_notebook_page_new, ULONG, HWND handle, DW_UNUSED(ULONG flags), int front) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8788 DW_FUNCTION_ADD_PARAM3(handle, flags, front) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8789 DW_FUNCTION_RETURN(dw_notebook_page_new, ULONG) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8790 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, DW_UNUSED(flags), ULONG, front, int) |
2372
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 DWNotebook *notebook = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8793 NSInteger page = [notebook pageid]; |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8794 DWNotebookPage *notepage = [[[DWNotebookPage alloc] init] retain]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8795 NSMutableArray<DWNotebookPage *> *views = [notebook views]; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8796 unsigned long retval; |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8797 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8798 [notepage setPageid:(int)page]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8799 if(front) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8800 { |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8801 [[notebook tabs] insertSegmentWithTitle:@"" atIndex:(NSInteger)0 animated:NO]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8802 [views addObject:notepage]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8803 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8804 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8805 { |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8806 [[notebook tabs] insertSegmentWithTitle:@"" atIndex:[[notebook tabs] numberOfSegments] animated:NO]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8807 [views addObject:notepage]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8808 } |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8809 [notebook addSubview:notepage]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8810 [notepage autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8811 [notebook setPageid:(int)(page+1)]; |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8812 |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8813 if([views count] != 1) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8814 { |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8815 /* Otherwise hide the page */ |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8816 [notepage setHidden:YES]; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8817 } |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8818 |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8819 retval = (unsigned long)page; |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8820 DW_FUNCTION_RETURN_THIS(retval); |
2372
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 |
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 * 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
|
8825 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8826 * 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
|
8827 * 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
|
8828 */ |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8829 DW_FUNCTION_DEFINITION(dw_notebook_page_destroy, void, HWND handle, unsigned int pageid) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8830 DW_FUNCTION_ADD_PARAM2(handle, pageid) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8831 DW_FUNCTION_NO_RETURN(dw_notebook_page_destroy) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8832 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, pageid, unsigned int) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8833 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8834 DWNotebook *notebook = handle; |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
8835 DWNotebookPage *notepage = _dw_notepage_from_id(notebook, pageid); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8836 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8837 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8838 if(notepage != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8839 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8840 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
|
8841 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
|
8842 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8843 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
|
8844 { |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8845 [[notebook tabs] removeSegmentAtIndex:index animated:NO]; |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8846 [notepage removeFromSuperview]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8847 [views removeObject:notepage]; |
2693
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8848 index--; |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8849 if(index >= 0 && index < [views count]) |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8850 [[notebook tabs] setSelectedSegmentIndex:index]; |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8851 else if([views count] > 0) |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8852 [[notebook tabs] setSelectedSegmentIndex:0]; |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8853 [notebook pageChanged:nil]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8854 [notepage release]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8855 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8856 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8857 DW_LOCAL_POOL_OUT; |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8858 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8859 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8860 |
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 * 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
|
8863 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8864 * 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
|
8865 */ |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8866 DW_FUNCTION_DEFINITION(dw_notebook_page_get, unsigned long, HWND handle) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8867 DW_FUNCTION_ADD_PARAM1(handle) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8868 DW_FUNCTION_RETURN(dw_notebook_page_get, unsigned long) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8869 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8870 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8871 DWNotebook *notebook = handle; |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8872 NSInteger index = [[notebook tabs] selectedSegmentIndex]; |
2413
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
8873 unsigned long retval = 0; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
8874 |
2419
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
8875 if(index != -1) |
2413
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
8876 { |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
8877 NSMutableArray<DWNotebookPage *> *views = [notebook views]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
8878 DWNotebookPage *notepage = [views objectAtIndex:index]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
8879 |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
8880 retval = [notepage pageid]; |
8727ad1a19c3
iOS: Fix notebook relayout on rotation. Also fix autosizing of controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2412
diff
changeset
|
8881 } |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8882 DW_FUNCTION_RETURN_THIS(retval); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8883 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8886 * 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
|
8887 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8888 * 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
|
8889 * 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
|
8890 */ |
2409
2ab3e88e5d68
iOS: Implement dw_notebook_page_set(). Fix statusbar offset location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2408
diff
changeset
|
8891 DW_FUNCTION_DEFINITION(dw_notebook_page_set, void, HWND handle, unsigned int pageid) |
2ab3e88e5d68
iOS: Implement dw_notebook_page_set(). Fix statusbar offset location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2408
diff
changeset
|
8892 DW_FUNCTION_ADD_PARAM2(handle, pageid) |
2ab3e88e5d68
iOS: Implement dw_notebook_page_set(). Fix statusbar offset location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2408
diff
changeset
|
8893 DW_FUNCTION_NO_RETURN(dw_notebook_page_set) |
2ab3e88e5d68
iOS: Implement dw_notebook_page_set(). Fix statusbar offset location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2408
diff
changeset
|
8894 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, pageid, unsigned int) |
2ab3e88e5d68
iOS: Implement dw_notebook_page_set(). Fix statusbar offset location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2408
diff
changeset
|
8895 { |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8896 DWNotebook *notebook = handle; |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
8897 DWNotebookPage *notepage = _dw_notepage_from_id(notebook, pageid); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8898 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8899 if(notepage != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8900 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8901 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
|
8902 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
|
8903 |
2419
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
8904 if(index != -1) |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
8905 { |
65ff339e9cd2
iOS: A number of fixes, notebook layout select first page if none selected.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2417
diff
changeset
|
8906 [[notebook tabs] setSelectedSegmentIndex:index]; |
2693
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8907 [notebook pageChanged:nil]; |
2409
2ab3e88e5d68
iOS: Implement dw_notebook_page_set(). Fix statusbar offset location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2408
diff
changeset
|
8908 } |
2ab3e88e5d68
iOS: Implement dw_notebook_page_set(). Fix statusbar offset location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2408
diff
changeset
|
8909 } |
2ab3e88e5d68
iOS: Implement dw_notebook_page_set(). Fix statusbar offset location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2408
diff
changeset
|
8910 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8911 } |
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 * 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
|
8915 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8916 * handle: Notebook handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8917 * 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
|
8918 * 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
|
8919 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8920 DW_FUNCTION_DEFINITION(dw_notebook_page_set_text, void, HWND handle, ULONG pageid, const char *text) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8921 DW_FUNCTION_ADD_PARAM3(handle, pageid, text) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8922 DW_FUNCTION_NO_RETURN(dw_notebook_page_set_text) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8923 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, pageid, ULONG, text, const char *) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8924 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8925 DWNotebook *notebook = handle; |
2693
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8926 DWNotebookPage *notepage = _dw_notepage_from_id(notebook, pageid); |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8927 |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8928 if(notepage != nil) |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8929 { |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8930 NSMutableArray<DWNotebookPage *> *views = [notebook views]; |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8931 NSUInteger index = [views indexOfObject:notepage]; |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8932 |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8933 if(index != -1) |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8934 [[notebook tabs] setTitle:[NSString stringWithUTF8String:text] forSegmentAtIndex:index]; |
0dac724f890f
iOS: Fixes for notebook pages. Wasn't always using the pageID.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2680
diff
changeset
|
8935 } |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
8936 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8937 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8938 |
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 * 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
|
8941 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8942 * handle: Notebook handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8943 * 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
|
8944 * 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
|
8945 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8946 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
|
8947 { |
2711
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
8948 /* Not supported here... do nothing */ |
2372
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8952 * 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
|
8953 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8954 * 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
|
8955 * 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
|
8956 * 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
|
8957 */ |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8958 DW_FUNCTION_DEFINITION(dw_notebook_pack, void, HWND handle, ULONG pageid, HWND page) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8959 DW_FUNCTION_ADD_PARAM3(handle, pageid, page) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8960 DW_FUNCTION_NO_RETURN(dw_notebook_pack) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8961 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, pageid, ULONG, page, HWND) |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8962 { |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8963 DWNotebook *notebook = handle; |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
8964 DWNotebookPage *notepage = _dw_notepage_from_id(notebook, pageid); |
2372
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(notepage != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8967 { |
2408
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8968 dw_box_pack_start(notepage, page, 0, 0, TRUE, TRUE, 0); |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8969 } |
795056df9efd
iOS: Initial functional implmentation of the notebook/tabbed control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2407
diff
changeset
|
8970 DW_FUNCTION_RETURN_NOTHING; |
2372
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8973 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8974 * 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
|
8975 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8976 * 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
|
8977 * title: The Window title. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8978 * 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
|
8979 */ |
2598
4a5364fe65b7
iOS: Add some code to include DWViewController in the UIResponder chain.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2593
diff
changeset
|
8980 DW_FUNCTION_DEFINITION(dw_window_new, HWND, DW_UNUSED(HWND hwndOwner), const char *title, ULONG flStyle) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8981 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
|
8982 DW_FUNCTION_RETURN(dw_window_new, HWND) |
2598
4a5364fe65b7
iOS: Add some code to include DWViewController in the UIResponder chain.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2593
diff
changeset
|
8983 DW_FUNCTION_RESTORE_PARAM3(DW_UNUSED(hwndOwner), HWND, title, char *, flStyle, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8984 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8985 DW_FUNCTION_INIT; |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
8986 CGRect screenrect = [[UIScreen mainScreen] bounds]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
8987 DWWindow *window = [[DWWindow alloc] initWithFrame:screenrect]; |
2385
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
8988 DWView *view = [[DWView alloc] init]; |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
8989 UIUserInterfaceStyle style = [[DWObj hiddenWindow] overrideUserInterfaceStyle]; |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
8990 |
2599
32728f6f7ccd
iOS: Add UINavigationBar and DWView to the rootViewController's view.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2598
diff
changeset
|
8991 /* Copy the overrideUserInterfaceStyle property from the hiddenWindow */ |
32728f6f7ccd
iOS: Add UINavigationBar and DWView to the rootViewController's view.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2598
diff
changeset
|
8992 if(style != UIUserInterfaceStyleUnspecified) |
32728f6f7ccd
iOS: Add UINavigationBar and DWView to the rootViewController's view.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2598
diff
changeset
|
8993 [window setOverrideUserInterfaceStyle:style]; |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
8994 [window setWindowLevel:UIWindowLevelNormal]; |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
8995 [window setRootViewController:[[DWViewController alloc] init]]; |
2409
2ab3e88e5d68
iOS: Implement dw_notebook_page_set(). Fix statusbar offset location.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2408
diff
changeset
|
8996 [window setBackgroundColor:[UIColor systemBackgroundColor]]; |
2599
32728f6f7ccd
iOS: Add UINavigationBar and DWView to the rootViewController's view.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2598
diff
changeset
|
8997 [[[window rootViewController] view] addSubview:view]; |
2638
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
8998 [_dw_toplevel_windows addObject:window]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
8999 |
2598
4a5364fe65b7
iOS: Add some code to include DWViewController in the UIResponder chain.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2593
diff
changeset
|
9000 /* Handle style flags... There is no visible frame... |
4a5364fe65b7
iOS: Add some code to include DWViewController in the UIResponder chain.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2593
diff
changeset
|
9001 * On iOS 13 and higher if a titlebar is requested create a navigation bar. |
4a5364fe65b7
iOS: Add some code to include DWViewController in the UIResponder chain.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2593
diff
changeset
|
9002 */ |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9003 if(@available(iOS 13.0, *)) { |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9004 NSString *nstitle = [NSString stringWithUTF8String:title]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9005 [window setLargeContentTitle:nstitle]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9006 if(flStyle & DW_FCF_TITLEBAR) |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9007 { |
2570
2c2941e01b67
iOS: Slight refactoring to handle the possibility that the status bar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2569
diff
changeset
|
9008 NSInteger sbheight = [[[window windowScene] statusBarManager] statusBarFrame].size.height; |
2674
dd0b29320a3d
iOS: Use the claimed default value for the navigation bar of 44 points.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2673
diff
changeset
|
9009 CGRect navrect = CGRectMake(0, sbheight, screenrect.size.width, 44); |
dd0b29320a3d
iOS: Use the claimed default value for the navigation bar of 44 points.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2673
diff
changeset
|
9010 UINavigationBar* navbar = [[UINavigationBar alloc] initWithFrame:navrect]; |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9011 UINavigationItem* navItem = [[UINavigationItem alloc] initWithTitle:nstitle]; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9012 |
2674
dd0b29320a3d
iOS: Use the claimed default value for the navigation bar of 44 points.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2673
diff
changeset
|
9013 /* Double check the intrinsic height... */ |
dd0b29320a3d
iOS: Use the claimed default value for the navigation bar of 44 points.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2673
diff
changeset
|
9014 CGSize navdefault = [navbar intrinsicContentSize]; |
dd0b29320a3d
iOS: Use the claimed default value for the navigation bar of 44 points.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2673
diff
changeset
|
9015 if(navdefault.height != navrect.size.height) |
dd0b29320a3d
iOS: Use the claimed default value for the navigation bar of 44 points.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2673
diff
changeset
|
9016 { |
dd0b29320a3d
iOS: Use the claimed default value for the navigation bar of 44 points.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2673
diff
changeset
|
9017 navrect.size.height = navdefault.height; |
dd0b29320a3d
iOS: Use the claimed default value for the navigation bar of 44 points.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2673
diff
changeset
|
9018 navbar.frame = navrect; |
dd0b29320a3d
iOS: Use the claimed default value for the navigation bar of 44 points.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2673
diff
changeset
|
9019 } |
dd0b29320a3d
iOS: Use the claimed default value for the navigation bar of 44 points.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2673
diff
changeset
|
9020 |
2673
a39e2ea6fa14
iOS: Only add the "Back" button to the Navigation Bar if the window has the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2649
diff
changeset
|
9021 /* We maintain a list of top-level windows...If there is more than one window, |
a39e2ea6fa14
iOS: Only add the "Back" button to the Navigation Bar if the window has the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2649
diff
changeset
|
9022 * and our window has the close button style, add a Back button that will close it. |
2638
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
9023 */ |
2673
a39e2ea6fa14
iOS: Only add the "Back" button to the Navigation Bar if the window has the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2649
diff
changeset
|
9024 if([_dw_toplevel_windows count] > 1 && flStyle & DW_FCF_CLOSEBUTTON) |
2638
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
9025 { |
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
9026 UIBarButtonItem *back = [[UIBarButtonItem alloc] initWithTitle:@"Back" |
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
9027 style:UIBarButtonItemStylePlain |
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
9028 target:window |
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
9029 action:@selector(closeWindow:)]; |
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
9030 |
2639
0be4b2e21885
iOS: Fix display of the Back button... closing the window seems to cause
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2638
diff
changeset
|
9031 navItem.leftBarButtonItem = back; |
2638
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
9032 } |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9033 [navbar setItems:@[navItem]]; |
2599
32728f6f7ccd
iOS: Add UINavigationBar and DWView to the rootViewController's view.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2598
diff
changeset
|
9034 [[[window rootViewController] view] addSubview:navbar]; |
32728f6f7ccd
iOS: Add UINavigationBar and DWView to the rootViewController's view.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2598
diff
changeset
|
9035 } |
32728f6f7ccd
iOS: Add UINavigationBar and DWView to the rootViewController's view.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2598
diff
changeset
|
9036 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9037 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
|
9038 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9039 |
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 * 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
|
9042 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9043 * 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
|
9044 * 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
|
9045 * 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
|
9046 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9047 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
|
9048 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9049 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
|
9050 NSValue *v; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9051 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9052 v = [NSValue valueWithPointer:params]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9053 params[0] = function; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9054 params[1] = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9055 [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
|
9056 free(params); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9057 DW_LOCAL_POOL_OUT; |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9060 |
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 * 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
|
9063 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9064 * 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
|
9065 * 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
|
9066 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9067 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
|
9068 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9069 /* 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
|
9070 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9071 |
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 * Makes the window visible. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9074 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9075 * 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
|
9076 */ |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9077 DW_FUNCTION_DEFINITION(dw_window_show, int, HWND handle) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9078 DW_FUNCTION_ADD_PARAM1(handle) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9079 DW_FUNCTION_RETURN(dw_window_show, int) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9080 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
2372
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 NSObject *object = handle; |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9083 int retval = DW_ERROR_NONE; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9084 |
2591
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
9085 if([ object isMemberOfClass:[DWWindow class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9086 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9087 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
|
9088 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
|
9089 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9090 /* 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
|
9091 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
|
9092 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9093 /* Determine the contents size */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9094 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
|
9095 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9096 if(![window shown]) |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
9097 { |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
9098 [window makeKeyAndVisible]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9099 [window setShown:YES]; |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
9100 } |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
9101 else |
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
9102 [window setHidden:NO]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9103 } |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9104 DW_FUNCTION_RETURN_THIS(retval); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9105 } |
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 * Makes the window invisible. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9109 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9110 * 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
|
9111 */ |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9112 DW_FUNCTION_DEFINITION(dw_window_hide, int, HWND handle) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9113 DW_FUNCTION_ADD_PARAM1(handle) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9114 DW_FUNCTION_RETURN(dw_window_hide, int) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9115 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
2372
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 NSObject *object = handle; |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9118 int retval = DW_ERROR_NONE; |
2372
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 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
|
9121 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9122 UIWindow *window = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9123 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9124 [window setHidden:YES]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9125 } |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
9126 DW_FUNCTION_RETURN_THIS(retval); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9127 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9128 |
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 * 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
|
9131 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9132 * 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
|
9133 * 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
|
9134 * 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
|
9135 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
9136 DW_FUNCTION_DEFINITION(dw_window_set_color, int, HWND handle, unsigned long fore, unsigned long back) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
9137 DW_FUNCTION_ADD_PARAM3(handle, fore, back) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
9138 DW_FUNCTION_RETURN(dw_window_set_color, int) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
9139 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, fore, unsigned long, back, unsigned long) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9140 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9141 id object = handle; |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
9142 unsigned long _fore = _dw_get_color(fore); |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
9143 unsigned long _back = _dw_get_color(back); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9144 UIColor *fg = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9145 UIColor *bg = NULL; |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
9146 int retval = DW_ERROR_NONE; |
2372
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 /* 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
|
9149 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
|
9150 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9151 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
|
9152 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9153 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
|
9154 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9155 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
|
9156 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9157 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9158 /* 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
|
9159 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
|
9160 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9161 object = [object textfield]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9162 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9163 /* 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
|
9164 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
|
9165 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9166 [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
|
9167 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9168 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
|
9169 { |
2385
a126b04b9996
iOS: dwcompat now builds on iOS as well... Fixes for running dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2384
diff
changeset
|
9170 [[object titleLabel] 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
|
9171 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9172 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
|
9173 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9174 [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
|
9175 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9176 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
|
9177 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9178 DWBox *box = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9179 |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
9180 [box setBackgroundColor:bg]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9181 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9182 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
|
9183 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9184 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9185 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9186 [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
|
9187 [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
|
9188 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9189 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
|
9190 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9191 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
|
9192 [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
|
9193 [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
|
9194 } |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
9195 DW_FUNCTION_RETURN_THIS(retval); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9196 } |
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 * 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
|
9200 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9201 * 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
|
9202 * 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
|
9203 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9204 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
|
9205 { |
2711
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
9206 /* No overlapping windows on iOS, unsupported */ |
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
9207 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
|
9208 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9209 |
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 * 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
|
9212 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9213 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9214 * 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
|
9215 * 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
|
9216 */ |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
9217 DW_FUNCTION_DEFINITION(dw_window_set_style, void, HWND handle, ULONG style, ULONG mask) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
9218 DW_FUNCTION_ADD_PARAM3(handle, style, mask) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
9219 DW_FUNCTION_NO_RETURN(dw_window_set_style) |
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
9220 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, style, ULONG, mask, ULONG) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9221 { |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
9222 id object = _dw_text_handle(handle); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9223 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9224 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
|
9225 { |
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
|
9226 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
|
9227 |
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
|
9228 [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
|
9229 if(mask & DW_DT_VCENTER) |
2705
ddcbed595a84
iOS: Implement HICN resizing and text/label vertical centering.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2704
diff
changeset
|
9230 [label setBaselineAdjustment:(style & DW_DT_VCENTER ? UIBaselineAdjustmentAlignCenters : UIBaselineAdjustmentNone)]; |
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
|
9231 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
|
9232 { |
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
|
9233 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
|
9234 [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
|
9235 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
|
9236 [label setLineBreakMode:NSLineBreakByTruncatingTail]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9237 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9238 } |
2425
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9239 else if([object isMemberOfClass:[DWMLE class]]) |
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9240 { |
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9241 DWMLE *mle = handle; |
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9242 [mle setTextAlignment:(style & mask)]; |
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9243 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9244 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
|
9245 { |
2425
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9246 DWMenuItem *menuitem = object; |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
9247 UIMenuElementState oldstate = [menuitem state]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
9248 BOOL oldenabled = [menuitem enabled]; |
2425
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9249 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9250 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
|
9251 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9252 if(style & DW_MIS_CHECKED) |
2425
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9253 [menuitem setState:UIMenuElementStateOn]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9254 else if(style & DW_MIS_UNCHECKED) |
2425
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9255 [menuitem setState:UIMenuElementStateOff]; |
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9256 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9257 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
|
9258 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9259 if(style & DW_MIS_ENABLED) |
2425
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9260 [menuitem setEnabled:YES]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9261 else if(style & DW_MIS_DISABLED) |
2425
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9262 [menuitem setEnabled:NO]; |
60a459df758d
iOS: Account for the special area at the bottom of certain devies.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2424
diff
changeset
|
9263 } |
2807
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
9264 /* Only force the menus to repopulate if something changed */ |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
9265 if(oldstate != [menuitem state] || oldenabled != [menuitem enabled]) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
9266 { |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
9267 for(id obj in _dw_toplevel_windows) |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
9268 [obj updateMenu]; |
975df4680ff7
iOS: Need to trigger window menu rebuilds if a menu item changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2804
diff
changeset
|
9269 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9270 } |
2399
1cbc316292c1
iOS: Move more functions into thread safety, iOS is very adamant about the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2396
diff
changeset
|
9271 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9272 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9275 * 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
|
9276 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9277 * 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
|
9278 * Remarks: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9279 * 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
|
9280 */ |
2400
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
9281 DW_FUNCTION_DEFINITION(dw_window_set_focus, void, HWND handle) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
9282 DW_FUNCTION_ADD_PARAM1(handle) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
9283 DW_FUNCTION_NO_RETURN(dw_window_set_focus) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
9284 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9285 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9286 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9287 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9288 [object becomeFirstResponder]; |
2400
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
9289 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9290 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9291 |
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 * 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
|
9294 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9295 * 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
|
9296 * 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
|
9297 * Remarks: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9298 * 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
|
9299 */ |
2400
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
9300 DW_FUNCTION_DEFINITION(dw_window_default, void, HWND handle, HWND defaultitem) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
9301 DW_FUNCTION_ADD_PARAM2(handle, defaultitem) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
9302 DW_FUNCTION_NO_RETURN(dw_window_default) |
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
9303 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, defaultitem, HWND) |
2372
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 DWWindow *window = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9306 id object = defaultitem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9307 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9308 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
|
9309 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9310 [object becomeFirstResponder]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9311 } |
2400
5e454dfab0db
iOS: More thread safety, remove some debug code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2399
diff
changeset
|
9312 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9313 } |
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 * 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
|
9317 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9318 * 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
|
9319 * 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
|
9320 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9321 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
|
9322 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9323 /* 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
|
9324 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9325 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9326 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9327 * 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
|
9328 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9329 * 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
|
9330 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9331 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
|
9332 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9333 /* 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
|
9334 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9337 * Releases previous mouse capture. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9338 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9339 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
|
9340 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9341 /* 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
|
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9345 * 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
|
9346 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9347 * 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
|
9348 * 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
|
9349 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9350 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
|
9351 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
9352 /* 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
|
9353 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9354 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9355 /* 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
|
9356 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9357 * currfont: current font |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9358 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9359 * 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
|
9360 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9361 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
|
9362 { |
2414
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
9363 NSPointerArray *params = [[NSPointerArray pointerArrayWithOptions:NSPointerFunctionsOpaqueMemory] retain]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
9364 char *font = NULL; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
9365 |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
9366 [params addPointer:(void *)currfont]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
9367 [DWObj safeCall:@selector(fontPicker:) withObject:params]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
9368 if([params count] > 1) |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
9369 font = [params pointerAtIndex:1]; |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
9370 |
5e5fab842901
iOS: Implement dw_font_choose() and dw_color_choose().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2413
diff
changeset
|
9371 return font; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9372 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9373 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9374 /* 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
|
9375 * 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
|
9376 */ |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
9377 Item *_dw_box_item(id object) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9378 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9379 /* 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
|
9380 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
|
9381 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9382 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
|
9383 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
9384 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
|
9385 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9386 Box *thisbox = [parent box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9387 Item *thisitem = thisbox->items; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9388 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9389 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9390 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
|
9391 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9392 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
|
9393 return &thisitem[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9394 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9395 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9396 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9397 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9398 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9401 * 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
|
9402 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9403 * 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
|
9404 * 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
|
9405 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9406 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
|
9407 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9408 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
|
9409 (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
|
9410 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9411 if(font) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9412 { |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
9413 id object = _dw_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
|
9414 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
|
9415 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9416 DWMLE *mle = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9417 |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
9418 [mle setFont:font]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9419 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9420 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
|
9421 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9422 [object setFont:font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9423 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9424 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
|
9425 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9426 DWRender *render = object; |
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 [render setFont:font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9429 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9430 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9431 return DW_ERROR_UNKNOWN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9432 /* If we changed the text... */ |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
9433 Item *item = _dw_box_item(handle); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9434 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9435 /* Check to see if any of the sizes need to be recalculated */ |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9436 if(item && (item->origwidth == DW_SIZE_AUTO || item->origheight == DW_SIZE_AUTO)) |
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9437 { |
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9438 _dw_control_size(handle, item->origwidth == DW_SIZE_AUTO ? &item->width : NULL, item->origheight == DW_SIZE_AUTO ? &item->height : NULL); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9439 /* 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
|
9440 _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
|
9441 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9442 return DW_ERROR_NONE; |
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 return DW_ERROR_UNKNOWN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9445 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9446 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9447 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9448 * 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
|
9449 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9450 * 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
|
9451 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9452 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
|
9453 { |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
9454 id object = _dw_text_handle(handle); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9455 UIFont *font = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9456 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
9457 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
|
9458 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9459 font = [object font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9460 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9461 if(font) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9462 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
9463 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
|
9464 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
|
9465 return strdup([output UTF8String]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9466 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9467 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9468 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9469 |
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 * 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
|
9472 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9473 * 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
|
9474 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9475 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
|
9476 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
|
9477 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
|
9478 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
|
9479 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9480 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9481 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9482 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9483 int retval = 0; |
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 /* Handle destroying a top-level window */ |
2638
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
9486 if([object isKindOfClass:[UIWindow class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9487 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9488 DWWindow *window = handle; |
2640
cee87daaf150
iOS: New method of removing DWWindow from the hierarchy.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2639
diff
changeset
|
9489 [window setHidden:YES]; |
2638
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
9490 [_dw_toplevel_windows removeObject:window]; |
2640
cee87daaf150
iOS: New method of removing DWWindow from the hierarchy.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2639
diff
changeset
|
9491 [[[window rootViewController] view] removeFromSuperview]; |
cee87daaf150
iOS: New method of removing DWWindow from the hierarchy.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2639
diff
changeset
|
9492 [window setRootViewController:nil]; |
2372
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 /* Handle removing menu items from menus */ |
2463
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
9495 else if([object isMemberOfClass:[DWMenuItem class]]) |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
9496 { |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
9497 DWMenuItem *item = object; |
79c7bf492bc1
iOS: Attempt to get context menus working for iOS 13+.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2459
diff
changeset
|
9498 DWMenu *menu = [item menu]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9499 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9500 [menu removeItem:object]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9501 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9502 /* 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
|
9503 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
|
9504 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9505 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
|
9506 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
9507 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
|
9508 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9509 id window = [object window]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9510 Box *thisbox = [parent box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9511 int z, index = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9512 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
|
9513 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9514 if(!thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9515 thisbox->count = 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 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
|
9518 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9519 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
|
9520 index = z; |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9523 if(index != -1) |
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 [object removeFromSuperview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9526 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9527 if(thisbox->count > 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9528 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9529 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
|
9530 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9531 /* 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
|
9532 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
|
9533 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9534 tmpitem[z] = thisitem[z]; |
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 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
|
9537 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9538 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
|
9539 } |
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 thisbox->items = tmpitem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9543 if(thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9544 free(thisitem); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9545 if(tmpitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9546 thisbox->count--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9547 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9548 thisbox->count = 0; |
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 /* 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
|
9551 _dw_redraw(window, TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9552 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9553 } |
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 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9556 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
|
9557 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9560 * 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
|
9561 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9562 * 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
|
9563 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9564 * 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
|
9565 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9566 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
|
9567 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
|
9568 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
|
9569 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
|
9570 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9571 DW_FUNCTION_INIT; |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
9572 id object = _dw_text_handle(handle); |
2589
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9573 id control = handle; |
2792
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9574 NSString *nsstr = nil; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9575 char *retval = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9576 |
2589
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9577 if([control isKindOfClass:[UIButton class]]) |
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9578 { |
2792
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9579 nsstr = [control titleForState:UIControlStateNormal]; |
2589
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9580 } |
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9581 else if([object isKindOfClass:[UILabel class]] || [object isKindOfClass:[UITextField class]]) |
2427
4f078d24fe83
iOS: Correct _dw_text_handle() behavior. Add UILabel/UITextView to controls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2426
diff
changeset
|
9582 { |
2792
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9583 nsstr = [object text]; |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9584 } |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9585 else if([object isMemberOfClass:[DWWindow class]]) |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9586 { |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9587 DWWindow *window = object; |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9588 UIView *view = [[window rootViewController] view]; |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9589 NSArray *array = [view subviews]; |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9590 |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9591 for(id obj in array) |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9592 { |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9593 if([obj isMemberOfClass:[UINavigationBar class]]) |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9594 { |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9595 UINavigationBar *nav = obj; |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9596 UINavigationItem *item = [[nav items] firstObject]; |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9597 |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9598 nsstr = [item title]; |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9599 } |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9600 } |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9601 } |
9c6fdafd10be
iOS: Implement dw_window_get_text() on top-level windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2791
diff
changeset
|
9602 if(nsstr && [nsstr length] > 0) |
2427
4f078d24fe83
iOS: Correct _dw_text_handle() behavior. Add UILabel/UITextView to controls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2426
diff
changeset
|
9603 retval = strdup([nsstr UTF8String]); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9604 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
|
9605 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9606 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9607 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9608 * 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
|
9609 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9610 * 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
|
9611 * 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
|
9612 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9613 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
|
9614 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
|
9615 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
|
9616 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
|
9617 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9618 DW_FUNCTION_INIT; |
2416
353581ebf4a5
iOS: Fix display of widgets. DWMLE and DWContainer are subclasses of UIScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2415
diff
changeset
|
9619 id object = _dw_text_handle(handle); |
2589
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9620 id control = handle; |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9621 Item *item = NULL; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9622 |
2589
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9623 if([control isKindOfClass:[UIButton class]]) |
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9624 { |
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9625 [control setTitle:[NSString stringWithUTF8String:text] forState:UIControlStateNormal]; |
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9626 item = _dw_box_item(handle); |
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9627 } |
e879afecf3ab
iOS: Fix dw_window_g/set_text() on buttons, can't use the label directly.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2588
diff
changeset
|
9628 else if([object isKindOfClass:[UILabel class]] || [object isKindOfClass:[UITextField class]]) |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9629 { |
2427
4f078d24fe83
iOS: Correct _dw_text_handle() behavior. Add UILabel/UITextView to controls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2426
diff
changeset
|
9630 [object setText:[NSString stringWithUTF8String:text]]; |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9631 item = _dw_box_item(handle); |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9632 } |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9633 else if([object isMemberOfClass:[DWWindow class]]) |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9634 { |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9635 DWWindow *window = object; |
2791
b62859fbd9a3
iOS: Fix dw_window_set_text() on a top-level window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2787
diff
changeset
|
9636 UIView *view = [[window rootViewController] view]; |
b62859fbd9a3
iOS: Fix dw_window_set_text() on a top-level window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2787
diff
changeset
|
9637 NSArray *array = [view subviews]; |
2591
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
9638 NSString *nstr = [NSString stringWithUTF8String:text]; |
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
9639 |
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
9640 [window setLargeContentTitle:nstr]; |
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
9641 |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9642 for(id obj in array) |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9643 { |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9644 if([obj isMemberOfClass:[UINavigationBar class]]) |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9645 { |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9646 UINavigationBar *nav = obj; |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9647 UINavigationItem *item = [[nav items] firstObject]; |
2591
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
9648 |
f3d423cdbc2e
iOS: Collection of various fixes...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2589
diff
changeset
|
9649 [item setTitle:nstr]; |
2569
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9650 } |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9651 } |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9652 } |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9653 /* If we changed the text... |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9654 * Check to see if any of the sizes need to be recalculated |
97b30df25fd1
iOS: If DW_FCF_TITLEBAR is passed to dw_window_new() create a UINavigationBar
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
9655 */ |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9656 if(item && (item->origwidth == DW_SIZE_AUTO || item->origheight == DW_SIZE_AUTO)) |
2372
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 int newwidth, newheight; |
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 _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
|
9661 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9662 /* Only update the item and redraw the window if it changed */ |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9663 if((item->origwidth == DW_SIZE_AUTO && item->width != newwidth) || |
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9664 (item->origheight == DW_SIZE_AUTO && item->height != newheight)) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9665 { |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9666 if(item->origwidth == DW_SIZE_AUTO) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9667 item->width = newwidth; |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9668 if(item->origheight == DW_SIZE_AUTO) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9669 item->height = newheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9670 /* 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
|
9671 _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
|
9672 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9673 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9674 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9675 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9678 * 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
|
9679 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9680 * 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
|
9681 * 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
|
9682 */ |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
9683 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
|
9684 { |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
9685 /* 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
|
9686 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9689 * Disables given window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9690 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9691 * 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
|
9692 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9693 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
|
9694 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
|
9695 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
|
9696 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
|
9697 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9698 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9699 id object = handle; |
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 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
|
9702 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9703 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
|
9704 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
|
9705 object = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9706 } |
2464
4fba0b9453ee
iOS: Fix calculating label size when there is no text. Use "gT" to calculate
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2463
diff
changeset
|
9707 if([object isKindOfClass:[UIControl class]] || [object isMemberOfClass:[DWMenuItem class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9708 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9709 [object setEnabled:NO]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9710 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9711 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
|
9712 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9713 UITextView *mle = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9714 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9715 [mle setEditable:NO]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9716 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9717 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9718 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9719 |
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 * Enables given window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9722 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9723 * 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
|
9724 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9725 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
|
9726 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
|
9727 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
|
9728 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
|
9729 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9730 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9731 id object = handle; |
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 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
|
9734 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9735 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
|
9736 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
|
9737 object = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9738 } |
2464
4fba0b9453ee
iOS: Fix calculating label size when there is no text. Use "gT" to calculate
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2463
diff
changeset
|
9739 if([object isKindOfClass:[UIControl class]] || [object isMemberOfClass:[DWMenuItem class]]) |
2372
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 [object setEnabled:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9742 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9743 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
|
9744 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9745 UITextView *mle = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9746 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9747 [mle setEditable:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9748 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9749 DW_FUNCTION_RETURN_NOTHING; |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9752 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9753 * 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
|
9754 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9755 * 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
|
9756 * 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
|
9757 * (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
|
9758 * 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
|
9759 * 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
|
9760 * 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
|
9761 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9762 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
|
9763 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9764 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9765 |
2450
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9766 if([object isKindOfClass:[UIImageView class]] || [object isMemberOfClass:[DWButton class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9767 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9768 if(data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9769 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9770 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9771 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
|
9772 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
|
9773 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9774 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9775 { |
2450
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9776 if([object isMemberOfClass:[DWButton class]]) |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9777 { |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9778 DWButton *button = object; |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9779 [button setImage:pixmap forState:UIControlStateNormal]; |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9780 } |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9781 else |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9782 { |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9783 UIImageView *iv = object; |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9784 [iv setImage:pixmap]; |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9785 } |
2372
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 /* If we changed the bitmap... */ |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
9788 Item *item = _dw_box_item(handle); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9789 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9790 /* Check to see if any of the sizes need to be recalculated */ |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9791 if(item && (item->origwidth == DW_SIZE_AUTO || item->origheight == DW_SIZE_AUTO)) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9792 { |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9793 _dw_control_size(handle, item->origwidth == DW_SIZE_AUTO ? &item->width : NULL, item->origheight == DW_SIZE_AUTO ? &item->height : NULL); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9794 /* 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
|
9795 _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
|
9796 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9797 DW_LOCAL_POOL_OUT; |
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 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9800 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
|
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9804 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9805 * 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
|
9806 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9807 * 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
|
9808 * 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
|
9809 * (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
|
9810 * 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
|
9811 * 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
|
9812 * 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
|
9813 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9814 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
|
9815 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9816 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9817 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9818 |
2450
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9819 if([object isKindOfClass:[UIImageView class]] || [object isMemberOfClass:[DWButton class]]) |
2372
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 UIImage *bitmap = nil; |
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 if(filename) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9824 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9825 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
|
9826 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
|
9827 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9828 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
|
9829 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9830 if(!bitmap && ext) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9831 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9832 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
|
9833 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
|
9834 } |
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 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
|
9837 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9838 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
|
9839 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9840 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9841 if(bitmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9842 { |
2450
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9843 if([object isMemberOfClass:[DWButton class]]) |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9844 { |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9845 DWButton *button = object; |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9846 [button setImage:bitmap forState:UIControlStateNormal]; |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9847 } |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9848 else |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9849 { |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9850 UIImageView *iv = object; |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9851 [iv setImage:bitmap]; |
2c03987c95bd
iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2449
diff
changeset
|
9852 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9853 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9854 /* If we changed the bitmap... */ |
2391
a7bfb97fd80e
iOS: Switch to using UIApplicationMain() in dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2390
diff
changeset
|
9855 Item *item = _dw_box_item(handle); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9856 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9857 /* Check to see if any of the sizes need to be recalculated */ |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9858 if(item && (item->origwidth == DW_SIZE_AUTO || item->origheight == DW_SIZE_AUTO)) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9859 { |
2740
9be24001d288
Style update. Add DW_SIZE_AUTO (-1) for passing automatic sizing to packing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2739
diff
changeset
|
9860 _dw_control_size(handle, item->origwidth == DW_SIZE_AUTO ? &item->width : NULL, item->origheight == DW_SIZE_AUTO ? &item->height : NULL); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9861 /* 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
|
9862 _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
|
9863 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9864 } |
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 DW_LOCAL_POOL_OUT; |
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 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9869 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9870 * 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
|
9871 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9872 * 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
|
9873 * 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
|
9874 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9875 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
|
9876 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9877 /* 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
|
9878 } |
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9881 * 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
|
9882 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9883 * 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
|
9884 * 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
|
9885 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9886 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
|
9887 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9888 NSObject *object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9889 UIView *view = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9890 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
|
9891 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9892 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
|
9893 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
|
9894 view = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9895 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9896 return [view viewWithTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9897 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9898 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9899 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9900 * 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
|
9901 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9902 * 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
|
9903 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9904 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
|
9905 { |
2711
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
9906 /* TODO: Not sure if we should do anything here on iOS */ |
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
9907 return DW_ERROR_GENERAL; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9908 } |
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 /* 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
|
9911 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9912 * 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
|
9913 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9914 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
|
9915 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9916 DWWindow *window = handle; |
2793
24977a1ec6fc
iOS: Rewrite dw_window_redraw() so it actually works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2792
diff
changeset
|
9917 NSArray *array = [[[window rootViewController] view] subviews]; |
24977a1ec6fc
iOS: Rewrite dw_window_redraw() so it actually works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2792
diff
changeset
|
9918 |
24977a1ec6fc
iOS: Rewrite dw_window_redraw() so it actually works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2792
diff
changeset
|
9919 for(id obj in array) |
24977a1ec6fc
iOS: Rewrite dw_window_redraw() so it actually works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2792
diff
changeset
|
9920 { |
24977a1ec6fc
iOS: Rewrite dw_window_redraw() so it actually works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2792
diff
changeset
|
9921 if([obj isMemberOfClass:[DWView class]]) |
24977a1ec6fc
iOS: Rewrite dw_window_redraw() so it actually works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2792
diff
changeset
|
9922 { |
24977a1ec6fc
iOS: Rewrite dw_window_redraw() so it actually works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2792
diff
changeset
|
9923 DWView *view = obj; |
24977a1ec6fc
iOS: Rewrite dw_window_redraw() so it actually works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2792
diff
changeset
|
9924 [view showWindow]; |
24977a1ec6fc
iOS: Rewrite dw_window_redraw() so it actually works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2792
diff
changeset
|
9925 } |
24977a1ec6fc
iOS: Rewrite dw_window_redraw() so it actually works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2792
diff
changeset
|
9926 } |
24977a1ec6fc
iOS: Rewrite dw_window_redraw() so it actually works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2792
diff
changeset
|
9927 |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
9928 [window setShown:YES]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9929 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9930 |
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 * Makes the window topmost. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9933 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9934 * 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
|
9935 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9936 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
|
9937 { |
2711
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
9938 /* TODO: Not sure if we should do anything here on iOS */ |
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
9939 return DW_ERROR_GENERAL; |
2372
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 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9943 * Makes the window bottommost. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9944 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9945 * 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
|
9946 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9947 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
|
9948 { |
2711
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
9949 /* TODO: Not sure if we should do anything here on iOS */ |
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
9950 return DW_ERROR_GENERAL; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9951 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9952 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9953 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9954 * 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
|
9955 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9956 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9957 * 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
|
9958 * 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
|
9959 */ |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
9960 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
|
9961 { |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
9962 /* 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
|
9963 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9964 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9965 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9966 * 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
|
9967 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9968 * 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
|
9969 * 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
|
9970 * 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
|
9971 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9972 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
|
9973 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9974 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9975 |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
9976 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
|
9977 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9978 Box *thisbox; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9979 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9980 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
|
9981 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9982 int depth = 0; |
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 /* Calculate space requirements */ |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
9985 _dw_resize_box(thisbox, &depth, 0, 0, 1); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9986 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9987 /* Return what was requested */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9988 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
|
9989 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
|
9990 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9991 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9992 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9993 _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
|
9994 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9995 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9996 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9997 * 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
|
9998 * 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
|
9999 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10000 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10001 * 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
|
10002 * 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
|
10003 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10004 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
|
10005 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10006 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
|
10007 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
|
10008 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10009 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10010 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10011 * 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
|
10012 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10013 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10014 * 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
|
10015 * 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
|
10016 */ |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
10017 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
|
10018 { |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
10019 /* 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
|
10020 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10021 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10022 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10023 * 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
|
10024 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10025 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10026 * 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
|
10027 * 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
|
10028 * 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
|
10029 * 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
|
10030 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10031 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
|
10032 { |
2711
00e42b9c9ebc
iOS: Similarly update the comments on unimplmented functions... a unofficial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2705
diff
changeset
|
10033 /* 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
|
10034 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10035 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10036 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10037 * 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
|
10038 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10039 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10040 * 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
|
10041 * 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
|
10042 * 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
|
10043 * 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
|
10044 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10045 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
|
10046 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10047 NSObject *object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10048 |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2541
diff
changeset
|
10049 if([object isKindOfClass:[UIWindow class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10050 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10051 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
|
10052 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
|
10053 if(x) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10054 *x = rect.origin.x; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10055 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
|
10056 *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
|
10057 if(width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10058 *width = rect.size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10059 if(height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10060 *height = rect.size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10061 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10062 } |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2541
diff
changeset
|
10063 else if([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
|
10064 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10065 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
|
10066 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
|
10067 if(x) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10068 *x = rect.origin.x; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10069 if(y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10070 *y = rect.origin.y; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10071 if(width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10072 *width = rect.size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10073 if(height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10074 *height = rect.size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10075 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10076 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10077 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10078 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10079 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10080 * 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
|
10081 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10082 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
|
10083 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
10084 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
|
10085 return screenRect.size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10086 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10087 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10088 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10089 * 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
|
10090 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10091 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
|
10092 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
10093 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
|
10094 return screenRect.size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10095 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10096 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10097 /* 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
|
10098 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
|
10099 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
10100 /* 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
|
10101 return 32; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10102 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10103 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10104 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10105 * 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
|
10106 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10107 * 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
|
10108 * 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
|
10109 * 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
|
10110 * 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
|
10111 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10112 * 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
|
10113 * 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
|
10114 * Remarks: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10115 * 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
|
10116 * 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
|
10117 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10118 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
|
10119 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10120 char outbuf[1025] = {0}; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10121 HWND retval = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10122 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10123 if(description) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10124 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10125 va_list args; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10126 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10127 va_start(args, description); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10128 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
|
10129 va_end(args); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10130 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10131 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10132 /* 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
|
10133 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
|
10134 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10135 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
|
10136 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10137 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
|
10138 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10139 if(notification) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10140 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10141 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
|
10142 if(description) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10143 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
|
10144 if(imagepath) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10145 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10146 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
|
10147 NSError *error; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10148 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
|
10149 URL:url |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10150 options:nil |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10151 error:&error]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10152 if(attachment) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10153 notification.attachments = @[attachment]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10154 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10155 retval = notification; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10156 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10157 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10158 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10159 return retval; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10160 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10161 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10162 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10163 * 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
|
10164 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10165 * 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
|
10166 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10167 * 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
|
10168 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10169 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
|
10170 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10171 if(notification) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10172 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10173 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
|
10174 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10175 /* Schedule the notification. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10176 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
|
10177 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10178 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
|
10179 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10180 UNMutableNotificationContent* content = (UNMutableNotificationContent *)notification; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10181 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
|
10182 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10183 UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10184 [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
|
10185 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10186 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10187 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10188 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10189 return DW_ERROR_UNKNOWN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10190 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10191 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10192 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10193 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10194 * 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
|
10195 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10196 * 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
|
10197 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10198 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
|
10199 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10200 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
|
10201 strcpy(env->osName, "iOS"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10202 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10203 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
|
10204 strncpy(env->buildTime, __TIME__, sizeof(env->buildTime)-1); |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2541
diff
changeset
|
10205 strncpy(env->htmlEngine, "WEBKIT", sizeof(env->htmlEngine)-1); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10206 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
|
10207 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
|
10208 #ifdef VER_REV |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10209 env->DWSubVersion = VER_REV; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10210 #else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10211 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
|
10212 #endif |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10213 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10214 env->MajorVersion = DWOSMajor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10215 env->MinorVersion = DWOSMinor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10216 env->MajorBuild = DWOSBuild; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10217 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10218 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10219 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10220 * Emits a beep. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10221 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10222 * freq: Frequency. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10223 * dur: Duration. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10224 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10225 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
|
10226 { |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10227 AudioServicesPlayAlertSound((SystemSoundID)1104); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10228 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10229 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10230 /* 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
|
10231 * 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
|
10232 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10233 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
|
10234 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10235 /* 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
|
10236 [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
|
10237 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10238 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10239 /* 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
|
10240 * 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
|
10241 * dw_window_get_data(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10242 */ |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10243 UserData *_dw_find_userdata(UserData **root, const char *varname) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10244 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10245 UserData *tmp = *root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10246 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10247 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10248 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10249 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
|
10250 return tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10251 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10252 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10253 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10254 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10255 |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10256 int _dw_new_userdata(UserData **root, const char *varname, void *data) |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10257 { |
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10258 UserData *new = _dw_find_userdata(root, varname); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10259 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10260 if(new) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10261 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10262 new->data = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10263 return TRUE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10264 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10265 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10266 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10267 new = malloc(sizeof(UserData)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10268 if(new) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10269 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10270 new->varname = strdup(varname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10271 new->data = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10272 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10273 new->next = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10274 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10275 if (!*root) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10276 *root = new; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10277 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10278 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10279 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
|
10280 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10281 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10282 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10283 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10284 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10285 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10286 prev->next = new; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10287 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10288 return TRUE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10289 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10290 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10291 return FALSE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10292 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10293 |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
10294 int _dw_remove_userdata(UserData **root, const char *varname, int all) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10295 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10296 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
|
10297 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10298 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10299 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10300 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
|
10301 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10302 if(!prev) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10303 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10304 *root = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10305 free(tmp->varname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10306 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10307 if(!all) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10308 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10309 tmp = *root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10310 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10311 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10312 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10313 /* 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
|
10314 * never get here. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10315 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10316 prev->next = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10317 free(tmp->varname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10318 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10319 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10320 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10321 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10322 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10323 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10324 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10325 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10326 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10327 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10328 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10329 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10330 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10331 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10332 * 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
|
10333 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10334 * 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
|
10335 * 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
|
10336 * 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
|
10337 */ |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10338 DW_FUNCTION_DEFINITION(dw_window_set_data, void, HWND window, const char *dataname, void *data) |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10339 DW_FUNCTION_ADD_PARAM3(window, dataname, data) |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10340 DW_FUNCTION_NO_RETURN(dw_window_set_data) |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10341 DW_FUNCTION_RESTORE_PARAM3(window, HWND, dataname, const char *, data, void *) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10342 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10343 id object = window; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10344 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
|
10345 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10346 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
|
10347 NSArray *subviews = [win subviews]; |
2739
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10348 for(id obj in subviews) |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10349 { |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10350 if([obj isMemberOfClass:[DWView class]]) |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10351 { |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10352 object = obj; |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10353 break; |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10354 } |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10355 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10356 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10357 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
|
10358 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10359 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
|
10360 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
|
10361 object = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10362 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10363 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
|
10364 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10365 if(!blah) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10366 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10367 if(!dataname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10368 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10369 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10370 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
|
10371 [object setUserdata:blah]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10372 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10373 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10374 if(data) |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10375 _dw_new_userdata(&(blah->root), dataname, data); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10376 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10377 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10378 if(dataname) |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
10379 _dw_remove_userdata(&(blah->root), dataname, FALSE); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10380 else |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
10381 _dw_remove_userdata(&(blah->root), NULL, TRUE); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10382 } |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10383 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10384 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10385 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10386 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10387 * 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
|
10388 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10389 * 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
|
10390 * 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
|
10391 * 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
|
10392 */ |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10393 DW_FUNCTION_DEFINITION(dw_window_get_data, void *, HWND window, const char *dataname) |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10394 DW_FUNCTION_ADD_PARAM2(window, dataname) |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10395 DW_FUNCTION_RETURN(dw_window_get_data, void *) |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10396 DW_FUNCTION_RESTORE_PARAM2(window, HWND, dataname, const char *) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10397 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10398 id object = window; |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10399 void *retval = NULL; |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10400 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10401 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
|
10402 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10403 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
|
10404 NSArray *subviews = [win subviews]; |
2739
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10405 for(id obj in subviews) |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10406 { |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10407 if([obj isMemberOfClass:[DWView class]]) |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10408 { |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10409 object = obj; |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10410 break; |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10411 } |
02c53dd5e21d
iOS: I used to save the user data on the DWView subview of a DWWindow...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2738
diff
changeset
|
10412 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10413 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10414 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
|
10415 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10416 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
|
10417 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
|
10418 object = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10419 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10420 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
|
10421 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10422 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
|
10423 { |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10424 UserData *ud = _dw_find_userdata(&(blah->root), dataname); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10425 if(ud) |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10426 retval = ud->data; |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10427 } |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10428 DW_FUNCTION_RETURN_THIS(retval); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10429 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10430 |
2532
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10431 /* |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10432 * Compare two window handles. |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10433 * Parameters: |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10434 * window1: First window handle to compare. |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10435 * window2: Second window handle to compare. |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10436 * Returns: |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10437 * TRUE if the windows are the same object, FALSE if not. |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10438 */ |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10439 int API dw_window_compare(HWND window1, HWND window2) |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10440 { |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10441 /* If anything special is require to compare... do it |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10442 * here otherwise just compare the handles. |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10443 */ |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10444 if(window1 && window2 && window1 == window2) |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10445 return TRUE; |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10446 return FALSE; |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10447 } |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2472
diff
changeset
|
10448 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10449 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10450 * 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
|
10451 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10452 * 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
|
10453 * 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
|
10454 * 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
|
10455 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10456 * 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
|
10457 */ |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10458 DW_FUNCTION_DEFINITION(dw_timer_connect, HTIMER, int interval, void *sigfunc, void *data) |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10459 DW_FUNCTION_ADD_PARAM3(interval, sigfunc, data) |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10460 DW_FUNCTION_RETURN(dw_timer_connect, HTIMER) |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10461 DW_FUNCTION_RESTORE_PARAM3(interval, int, sigfunc, void *, data, void *) |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10462 { |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10463 HTIMER retval = 0; |
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10464 |
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10465 if(sigfunc) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10466 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10467 NSTimeInterval seconds = (double)interval / 1000.0; |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10468 |
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10469 retval = [NSTimer scheduledTimerWithTimeInterval:seconds target:DWHandler selector:@selector(runTimer:) userInfo:nil repeats:YES]; |
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10470 _dw_new_signal(0, retval, 0, sigfunc, NULL, data); |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10471 } |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10472 DW_FUNCTION_RETURN_THIS(retval); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10473 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10474 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10475 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10476 * Removes timer callback. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10477 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10478 * 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
|
10479 */ |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10480 DW_FUNCTION_DEFINITION(dw_timer_disconnect, void, HTIMER timerid) |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10481 DW_FUNCTION_ADD_PARAM1(timerid) |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10482 DW_FUNCTION_NO_RETURN(dw_timer_disconnect) |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10483 DW_FUNCTION_RESTORE_PARAM1(timerid, HTIMER) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10484 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
10485 DWSignalHandler *prev = NULL, *tmp = DWRoot; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10486 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10487 /* 0 is an invalid timer ID */ |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10488 if(timerid) |
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10489 { |
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10490 NSTimer *thistimer = timerid; |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10491 |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10492 [thistimer invalidate]; |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10493 |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10494 while(tmp) |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10495 { |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2583
diff
changeset
|
10496 if(tmp->window == thistimer) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10497 { |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10498 if(prev) |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10499 { |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10500 prev->next = tmp->next; |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10501 free(tmp); |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10502 tmp = prev->next; |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10503 } |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10504 else |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10505 { |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10506 DWRoot = tmp->next; |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10507 free(tmp); |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10508 tmp = DWRoot; |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10509 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10510 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10511 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10512 { |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10513 prev = tmp; |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10514 tmp = tmp->next; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10515 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10516 } |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10517 } |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
10518 DW_FUNCTION_RETURN_NOTHING; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10519 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10520 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10521 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10522 * 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
|
10523 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10524 * 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
|
10525 * 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
|
10526 * 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
|
10527 * 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
|
10528 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10529 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
|
10530 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10531 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
|
10532 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10533 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10534 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10535 * 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
|
10536 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10537 * 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
|
10538 * 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
|
10539 * 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
|
10540 * 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
|
10541 * 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
|
10542 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10543 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
|
10544 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10545 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
|
10546 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10547 /* 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
|
10548 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
|
10549 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10550 window = DWApp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10551 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10552 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10553 if(window && signame && sigfunc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10554 { |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
10555 if((message = _dw_findsigmessage(signame)) != 0) |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
10556 { |
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
10557 _dw_new_signal(message, window, (int)msgid, sigfunc, discfunc, data); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10558 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10559 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10560 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10561 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10562 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10563 * 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
|
10564 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10565 * 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
|
10566 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10567 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
|
10568 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
10569 DWSignalHandler *prev = NULL, *tmp = DWRoot; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10570 ULONG message; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10571 |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
10572 if(!window || !signame || (message = _dw_findsigmessage(signame)) == 0) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10573 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10574 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10575 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10576 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10577 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
|
10578 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10579 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
|
10580 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10581 if(discfunc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10582 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10583 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
|
10584 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10585 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10586 if(prev) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10587 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10588 prev->next = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10589 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10590 tmp = prev->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10591 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10592 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10593 { |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10594 DWRoot = tmp->next; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10595 free(tmp); |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10596 tmp = DWRoot; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10597 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10598 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10599 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10600 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10601 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10602 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10603 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10604 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10605 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10606 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10607 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10608 * 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
|
10609 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10610 * 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
|
10611 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10612 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
|
10613 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
10614 DWSignalHandler *prev = NULL, *tmp = DWRoot; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10615 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10616 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10617 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10618 if(tmp->window == window) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10619 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10620 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
|
10621 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10622 if(discfunc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10623 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10624 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
|
10625 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10626 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10627 if(prev) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10628 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10629 prev->next = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10630 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10631 tmp = prev->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10632 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10633 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10634 { |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10635 DWRoot = tmp->next; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10636 free(tmp); |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10637 tmp = DWRoot; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10638 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10639 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10640 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10641 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10642 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10643 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10644 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10645 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10646 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10647 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10648 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10649 * 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
|
10650 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10651 * 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
|
10652 * 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
|
10653 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10654 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
|
10655 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2622
diff
changeset
|
10656 DWSignalHandler *prev = NULL, *tmp = DWRoot; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10657 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10658 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10659 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10660 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
|
10661 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10662 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
|
10663 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10664 if(discfunc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10665 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10666 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
|
10667 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10668 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10669 if(prev) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10670 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10671 prev->next = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10672 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10673 tmp = prev->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10674 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10675 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10676 { |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10677 DWRoot = tmp->next; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10678 free(tmp); |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10679 tmp = DWRoot; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10680 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10681 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10682 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10683 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10684 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10685 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10686 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10687 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10688 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10689 |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10690 void _dw_my_strlwr(char *buf) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10691 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10692 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
|
10693 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10694 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
|
10695 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10696 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
|
10697 buf[z] -= 'A' - 'a'; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10698 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10699 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10700 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10701 /* 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
|
10702 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10703 * 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
|
10704 * 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
|
10705 * 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
|
10706 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10707 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
|
10708 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10709 int len; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10710 char *newname; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10711 char errorbuf[1025]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10712 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10713 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10714 if(!handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10715 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10716 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10717 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
|
10718 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10719 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10720 /* Lenth + "lib" + ".dylib" + NULL */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10721 newname = malloc(len + 10); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10722 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10723 if(!newname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10724 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10725 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10726 sprintf(newname, "lib%s.dylib", name); |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10727 _dw_my_strlwr(newname); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10728 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10729 *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
|
10730 if(*handle == NULL) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10731 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10732 strncpy(errorbuf, dlerror(), 1024); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10733 printf("%s\n", errorbuf); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10734 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
|
10735 *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
|
10736 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10737 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10738 free(newname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10739 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10740 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
|
10741 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10742 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10743 /* 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
|
10744 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10745 * 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
|
10746 * 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
|
10747 * 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
|
10748 * the address. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10749 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10750 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
|
10751 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10752 if(!func || !name) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10753 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10754 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10755 if(strlen(name) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10756 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10757 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10758 *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
|
10759 return (NULL == *func); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10760 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10761 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10762 /* 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
|
10763 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10764 * 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
|
10765 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10766 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
|
10767 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10768 if(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10769 return dlclose(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10770 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10771 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10772 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10773 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10774 * 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
|
10775 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10776 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
|
10777 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10778 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
|
10779 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10780 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
|
10781 return mutex; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10782 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10783 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10784 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10785 * 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
|
10786 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10787 * 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
|
10788 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10789 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
|
10790 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10791 if(mutex) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10792 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10793 pthread_mutex_destroy(mutex); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10794 free(mutex); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10795 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10796 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10797 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10798 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10799 * 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
|
10800 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10801 * 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
|
10802 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10803 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
|
10804 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10805 /* 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
|
10806 * 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
|
10807 * 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
|
10808 * 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
|
10809 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10810 if(DWThread == pthread_self()) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10811 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10812 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
|
10813 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10814 /* Process any pending events */ |
2635
3ec675648cf5
iOS: _dw_main_iteration() never seems to return NO.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
10815 _dw_main_iteration([NSDate dateWithTimeIntervalSinceNow:0.01]); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10816 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10817 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10818 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10819 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10820 pthread_mutex_lock(mutex); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10821 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10822 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10823 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10824 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10825 * 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
|
10826 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10827 * 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
|
10828 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10829 * 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
|
10830 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10831 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
|
10832 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10833 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
|
10834 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10835 return DW_ERROR_TIMEOUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10836 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10837 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10838 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10839 * 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
|
10840 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10841 * 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
|
10842 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10843 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
|
10844 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10845 pthread_mutex_unlock(mutex); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10846 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10847 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10848 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10849 * 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
|
10850 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10851 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
|
10852 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10853 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
|
10854 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10855 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10856 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10857 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10858 /* 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
|
10859 * 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
|
10860 * 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
|
10861 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10862 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
|
10863 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
|
10864 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
|
10865 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10866 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
|
10867 eve->alive = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10868 eve->posted = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10869 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10870 return eve; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10871 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10872 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10873 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10874 * 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
|
10875 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10876 * 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
|
10877 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10878 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
|
10879 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10880 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10881 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
|
10882 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10883 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
|
10884 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
|
10885 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
|
10886 eve->posted = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10887 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
|
10888 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10889 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10890 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10891 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10892 * 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
|
10893 * 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
|
10894 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10895 * 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
|
10896 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10897 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
|
10898 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10899 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10900 return FALSE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10901 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10902 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
|
10903 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
|
10904 eve->posted = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10905 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
|
10906 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10907 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10908 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10909 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10910 * 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
|
10911 * 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
|
10912 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10913 * 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
|
10914 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10915 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
|
10916 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10917 int rc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10918 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10919 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10920 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
|
10921 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10922 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
|
10923 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10924 if(eve->posted) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10925 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10926 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
|
10927 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10928 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10929 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10930 if(timeout != -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10931 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10932 struct timeval now; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10933 struct timespec timeo; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10934 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10935 gettimeofday(&now, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10936 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
|
10937 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
|
10938 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
|
10939 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10940 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10941 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
|
10942 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
|
10943 if(!rc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10944 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10945 if(rc == ETIMEDOUT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10946 return DW_ERROR_TIMEOUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10947 return DW_ERROR_GENERAL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10948 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10949 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10950 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10951 * 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
|
10952 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10953 * 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
|
10954 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10955 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
|
10956 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10957 if(!eve || !(*eve)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10958 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
|
10959 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10960 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
|
10961 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
|
10962 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
|
10963 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
|
10964 free(*eve); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10965 *eve = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10966 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10967 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10968 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10969 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10970 struct _seminfo { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10971 int fd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10972 int waiting; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10973 }; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10974 |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
10975 static void _dw_handle_sem(int *tmpsock) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10976 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10977 fd_set rd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10978 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
|
10979 int listenfd = tmpsock[0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10980 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
|
10981 char command; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10982 sigset_t mask; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10983 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10984 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
|
10985 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
|
10986 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10987 /* problems */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10988 if(tmpsock[1] == -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10989 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10990 free(array); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10991 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10992 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10993 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10994 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
|
10995 array[0].waiting = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10996 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10997 /* 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
|
10998 free(tmpsock); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10999 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11000 while(1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11001 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11002 FD_ZERO(&rd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11003 FD_SET(listenfd, &rd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11004 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11005 maxfd = listenfd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11006 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11007 /* 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
|
11008 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
|
11009 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11010 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
|
11011 maxfd = array[z].fd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11012 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11013 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
|
11014 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11015 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11016 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
|
11017 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11018 free(array); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11019 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11020 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11021 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11022 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
|
11023 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11024 struct _seminfo *newarray; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11025 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
|
11026 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11027 if(newfd > -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11028 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11029 /* 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
|
11030 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
|
11031 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
|
11032 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11033 newarray[connectcount].fd = newfd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11034 newarray[connectcount].waiting = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11035 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11036 connectcount++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11037 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11038 /* 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
|
11039 free(array); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11040 array = newarray; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11041 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11042 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11043 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11044 /* 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
|
11045 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
|
11046 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11047 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
|
11048 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11049 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
|
11050 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11051 struct _seminfo *newarray = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11052 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11053 /* 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
|
11054 if(connectcount > 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11055 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11056 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
|
11057 if(!z) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11058 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
|
11059 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11060 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11061 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
|
11062 if(z!=(connectcount-1)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11063 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
|
11064 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11065 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11066 connectcount--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11067 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11068 /* 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
|
11069 free(array); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11070 array = newarray; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11071 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11072 else if(bytesread == 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11073 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11074 switch(command) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11075 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11076 case 0: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11077 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11078 /* Reset */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11079 posted = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11080 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11081 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11082 case 1: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11083 /* Post */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11084 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11085 int s; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11086 char tmp = (char)0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11087 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11088 posted = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11089 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11090 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
|
11091 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11092 /* 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
|
11093 * 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
|
11094 * continue. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11095 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11096 if(array[s].waiting) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11097 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
|
11098 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11099 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11100 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11101 case 2: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11102 /* Wait */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11103 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11104 char tmp = (char)0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11105 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11106 array[z].waiting = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11107 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11108 /* 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
|
11109 if(posted) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11110 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
|
11111 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11112 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11113 case 3: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11114 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11115 /* Done Waiting */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11116 array[z].waiting = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11117 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11118 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11119 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11120 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11121 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11122 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11123 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11124 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11125 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11126 /* 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
|
11127 /* 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
|
11128 * opened from other processes. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11129 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11130 * 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
|
11131 * 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
|
11132 * by other processes. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11133 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11134 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
|
11135 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11136 struct sockaddr_un un; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11137 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
|
11138 HEV eve; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11139 DWTID dwthread; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11140 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11141 if(!tmpsock) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11142 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11143 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11144 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
|
11145 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11146 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11147 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11148 free(tmpsock); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11149 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11150 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11151 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11152 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
|
11153 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
|
11154 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
|
11155 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
|
11156 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
|
11157 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
|
11158 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
|
11159 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11160 /* 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
|
11161 * to support multiple instances. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11162 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11163 remove(un.sun_path); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11164 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11165 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
|
11166 listen(tmpsock[0], 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11167 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
|
11168 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
|
11169 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11170 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
|
11171 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11172 if(tmpsock[0] > -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11173 close(tmpsock[0]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11174 if(tmpsock[1] > -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11175 close(tmpsock[1]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11176 if(ev > -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11177 close(ev); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11178 free(tmpsock); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11179 free(eve); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11180 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11181 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11182 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11183 /* Create a thread to handle this event semaphore */ |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
11184 pthread_create(&dwthread, NULL, (void *)_dw_handle_sem, (void *)tmpsock); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11185 eve->alive = ev; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11186 return eve; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11187 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11188 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11189 /* 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
|
11190 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11191 * 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
|
11192 * 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
|
11193 * by other processes. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11194 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11195 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
|
11196 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11197 struct sockaddr_un un; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11198 HEV eve; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11199 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
|
11200 if(ev < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11201 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11202 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11203 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
|
11204 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11205 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11206 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11207 close(ev); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11208 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11209 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11210 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11211 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
|
11212 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
|
11213 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
|
11214 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
|
11215 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
|
11216 eve->alive = ev; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11217 return eve; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11218 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11219 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11220 /* 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
|
11221 * 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
|
11222 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11223 * 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
|
11224 * 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
|
11225 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11226 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
|
11227 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11228 /* signal reset */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11229 char tmp = (char)0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11230 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11231 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
|
11232 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11233 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11234 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
|
11235 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11236 return 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11237 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11238 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11239 /* 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
|
11240 * 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
|
11241 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11242 * 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
|
11243 * 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
|
11244 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11245 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
|
11246 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11247 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11248 /* signal post */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11249 char tmp = (char)1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11250 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11251 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
|
11252 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11253 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11254 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
|
11255 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11256 return 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11257 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11258 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11259 /* 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
|
11260 * 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
|
11261 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11262 * 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
|
11263 * 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
|
11264 * 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
|
11265 * or -1 if indefinite. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11266 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11267 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
|
11268 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11269 fd_set rd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11270 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
|
11271 int retval = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11272 char tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11273 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11274 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
|
11275 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
|
11276 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11277 /* 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
|
11278 if(timeout != -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11279 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11280 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
|
11281 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
|
11282 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11283 useme = &tv; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11284 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11285 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11286 FD_ZERO(&rd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11287 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
|
11288 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11289 /* Signal wait */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11290 tmp = (char)2; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11291 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
|
11292 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11293 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
|
11294 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11295 /* Signal done waiting. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11296 tmp = (char)3; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11297 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
|
11298 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11299 if(retval == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11300 return DW_ERROR_TIMEOUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11301 else if(retval == -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11302 return DW_ERROR_INTERRUPT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11303 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11304 /* 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
|
11305 * 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
|
11306 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11307 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
|
11308 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11309 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11310 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11311 /* 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
|
11312 * 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
|
11313 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11314 * 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
|
11315 * 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
|
11316 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11317 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
|
11318 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11319 /* Finally close the domain socket, |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
11320 * cleanup will continue in _dw_handle_sem. |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11321 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11322 if(eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11323 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11324 close(eve->alive); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11325 free(eve); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11326 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11327 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11328 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11329 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11330 /* 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
|
11331 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
|
11332 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11333 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
|
11334 [pool drain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11335 pool = [[NSAutoreleasePool alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11336 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
|
11337 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11338 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11339 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11340 * 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
|
11341 * 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
|
11342 * 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
|
11343 * 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
|
11344 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11345 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
|
11346 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11347 /* 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
|
11348 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
|
11349 pthread_setspecific(_dw_pool_key, pool); |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
11350 _dw_init_colors(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11351 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11352 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11353 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11354 * 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
|
11355 * 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
|
11356 * 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
|
11357 * 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
|
11358 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11359 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
|
11360 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11361 UIColor *color; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11362 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11363 /* 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
|
11364 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
|
11365 [color release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11366 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
|
11367 [color release]; |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
11368 NSAutoreleasePool *pool = pthread_getspecific(_dw_pool_key); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11369 [pool drain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11370 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11371 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11372 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11373 * Setup thread independent pools. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11374 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11375 void _dwthreadstart(void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11376 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11377 void (*threadfunc)(void *) = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11378 void **tmp = (void **)data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11379 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11380 _dw_init_thread(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11381 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11382 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
|
11383 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11384 /* Start our thread function */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11385 threadfunc(tmp[1]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11386 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11387 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11388 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11389 _dw_deinit_thread(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11390 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11391 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11392 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11393 * 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
|
11394 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11395 * 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
|
11396 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11397 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
|
11398 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11399 UIFont *oldfont = DWDefaultFont; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11400 DWDefaultFont = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11401 if(fontname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11402 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11403 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
|
11404 [DWDefaultFont retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11405 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11406 [oldfont release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11407 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11408 |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11409 /* Thread start stub to launch our main */ |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11410 void _dw_main_launch(void **data) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11411 { |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11412 int (*_dwmain)(int argc, char **argv) = (int (*)(int, char **))data[0]; |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11413 int argc = DW_POINTER_TO_INT(data[1]); |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11414 char **argv = (char **)data[2]; |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11415 |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11416 _dwmain(argc, argv); |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11417 free(data); |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11418 } |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11419 |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11420 /* The iOS main thread... all this does is handle messages */ |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11421 void _dw_main_thread(int argc, char *argv[]) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11422 { |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11423 DWMainEvent = dw_event_new(); |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11424 dw_event_reset(DWMainEvent); |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11425 /* We wait for the dw_init() in the user's main function */ |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11426 dw_event_wait(DWMainEvent, DW_TIMEOUT_INFINITE); |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11427 DWThread = dw_thread_id(); |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11428 DWObj = [[DWObject alloc] init]; |
2407
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
11429 /* Create object for handling timers */ |
6336244aa895
iOS: Fix timers and implement dw_beep().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2405
diff
changeset
|
11430 DWHandler = [[DWTimerHandler alloc] init]; |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11431 UIApplicationMain(argc, argv, nil, NSStringFromClass([DWAppDel class])); |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11432 /* Shouldn't get here, but ... just in case */ |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11433 DWThread = (DWTID)-1; |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11434 } |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11435 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11436 /* 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
|
11437 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
|
11438 { |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11439 /* The UIApplication singleton won't be created until we call |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11440 * UIApplicationMain() which blocks indefinitely.. so we have |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11441 * a thread to just run UIApplicationMain() .. and wait until |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11442 * we get a non-nil sharedApplication result. |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11443 */ |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11444 while(!DWApp) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11445 { |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11446 static int posted = FALSE; |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11447 |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11448 if(DWMainEvent && !posted) |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11449 { |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11450 /* Post the DWMainEvent so the main thread |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11451 * will call UIApplicationMain() creating |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11452 * the UIApplication sharedApplication. |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11453 */ |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11454 posted = TRUE; |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11455 dw_event_post(DWMainEvent); |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11456 } |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11457 pthread_yield_np(); |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
11458 DWApp = [UIApplication sharedApplication]; |
2396
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11459 } |
5bb3491ceba2
iOS: Get iOS basic funcionality working by creating dwmain() macros.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2395
diff
changeset
|
11460 dw_event_reset(DWMainEvent); |
2402
b28852b35452
iOS: Fix message boxes... the hiddenWindow they are attached to was being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2401
diff
changeset
|
11461 [DWObj performSelectorOnMainThread:@selector(delayedInit:) withObject:nil waitUntilDone:YES]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11462 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11463 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11464 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11465 * 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
|
11466 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11467 * 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
|
11468 * 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
|
11469 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11470 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
|
11471 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11472 char *lang = getenv("LANG"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11473 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11474 /* 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
|
11475 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
|
11476 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11477 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
|
11478 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
|
11479 char *binname = strrchr(pathcopy, '/'); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11480 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11481 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
|
11482 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11483 /* 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
|
11484 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
|
11485 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11486 if(app) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11487 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11488 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
|
11489 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
|
11490 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11491 if(len > 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11492 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11493 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
|
11494 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11495 *app = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11496 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11497 getcwd(pathbuf, PATH_MAX); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11498 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11499 /* 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
|
11500 if(strcmp(pathbuf, "/") == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11501 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11502 char *pos = strrchr(pathcopy, '/'); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11503 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11504 if(pos) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11505 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11506 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
|
11507 chdir(pathbuf); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11508 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11509 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11510 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11511 if(pathcopy) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11512 free(pathcopy); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11513 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11514 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11515 /* 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
|
11516 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
|
11517 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
|
11518 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11519 /* 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
|
11520 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
|
11521 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
|
11522 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
|
11523 /* 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
|
11524 * 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
|
11525 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11526 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
|
11527 /* Create the application object */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11528 _dw_app_init(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11529 pthread_key_create(&_dw_pool_key, NULL); |
2393
6669e152e30b
iOS: More namespace cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2391
diff
changeset
|
11530 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
2638
b7cc83cf70fa
iOS: Attempt to add "Back" button to secondaries windows to allow them to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2635
diff
changeset
|
11531 _dw_toplevel_windows = [[NSMutableArray new] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11532 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
|
11533 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
|
11534 pthread_key_create(&_dw_bg_color_key, NULL); |
2390
2613d1533f1a
iOS: Fix initial window display and handle resize/rotation events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2389
diff
changeset
|
11535 _dw_init_colors(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11536 DWDefaultFont = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11537 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
|
11538 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11539 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
|
11540 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11541 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11542 if(center) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11543 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11544 [center requestAuthorizationWithOptions:UNAuthorizationOptionAlert|UNAuthorizationOptionSound |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11545 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
|
11546 if (granted) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11547 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11548 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
|
11549 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11550 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11551 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11552 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
|
11553 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11554 }]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11555 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11556 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11557 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11558 _DWDirtyDrawables = [[NSMutableArray alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11559 /* 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
|
11560 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
|
11561 [thread start]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11562 [thread release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11563 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
|
11564 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11565 /* 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
|
11566 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
|
11567 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11568 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11569 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11570 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11571 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11572 * 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
|
11573 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11574 * 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
|
11575 * 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
|
11576 * 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
|
11577 * 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
|
11578 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11579 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
|
11580 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11581 char namebuf[1025] = {0}; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11582 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
|
11583 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11584 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
|
11585 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
|
11586 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11587 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
|
11588 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11589 free(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11590 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11591 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11592 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11593 ftruncate(handle->fd, size); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11594 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11595 /* 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
|
11596 *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
|
11597 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11598 if(*dest == MAP_FAILED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11599 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11600 close(handle->fd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11601 *dest = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11602 free(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11603 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11604 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11605 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11606 handle->size = size; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11607 handle->sid = getsid(0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11608 handle->path = strdup(namebuf); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11609 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11610 return handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11611 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11612 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11613 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11614 * 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
|
11615 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11616 * 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
|
11617 * 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
|
11618 * 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
|
11619 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11620 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
|
11621 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11622 char namebuf[1025]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11623 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
|
11624 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11625 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
|
11626 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
|
11627 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11628 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
|
11629 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11630 free(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11631 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11632 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11633 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11634 /* 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
|
11635 *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
|
11636 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11637 if(*dest == MAP_FAILED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11638 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11639 close(handle->fd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11640 *dest = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11641 free(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11642 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11643 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11644 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11645 handle->size = size; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11646 handle->sid = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11647 handle->path = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11648 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11649 return handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11650 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11651 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11652 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11653 * 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
|
11654 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11655 * 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
|
11656 * 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
|
11657 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11658 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
|
11659 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11660 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
|
11661 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
|
11662 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11663 close(h->fd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11664 if(h->path) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11665 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11666 /* 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
|
11667 * creator of the file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11668 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11669 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
|
11670 remove(h->path); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11671 free(h->path); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11672 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11673 return rc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11674 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11675 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11676 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11677 * 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
|
11678 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11679 * 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
|
11680 * 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
|
11681 * 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
|
11682 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11683 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
|
11684 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11685 DWTID thread; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11686 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
|
11687 int rc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11688 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11689 tmp[0] = func; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11690 tmp[1] = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11691 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11692 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
|
11693 if(rc == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11694 return thread; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11695 return (DWTID)-1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11696 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11697 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11698 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11699 * 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
|
11700 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11701 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
|
11702 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11703 pthread_exit(NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11704 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11705 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11706 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11707 * 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
|
11708 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11709 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
|
11710 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11711 return (DWTID)pthread_self(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11712 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11713 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11714 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11715 * 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
|
11716 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11717 * 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
|
11718 * 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
|
11719 * 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
|
11720 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11721 * 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
|
11722 */ |
2698
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11723 int API dw_exec(const char *program, int type, char **params) |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11724 { |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11725 int retval = DW_ERROR_UNKNOWN; |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11726 pid_t pid; |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11727 |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11728 /* Launch the application directly using posix_spawnp() |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11729 * Might need to use openURLs to open DW_EXEC_GUI. |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11730 */ |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11731 if(posix_spawnp(&pid, program, NULL, NULL, params, NULL) == 0) |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11732 { |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11733 if(pid > 0) |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11734 retval = pid; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11735 else |
2698
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11736 retval = DW_ERROR_NONE; |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11737 } |
5c43d1ee9736
iOS: Implement dw_exec() using posix_spawnp(). Fix a few warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2693
diff
changeset
|
11738 return retval; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11739 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11740 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11741 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11742 * 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
|
11743 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11744 * url: Uniform resource locator. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11745 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11746 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
|
11747 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11748 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
|
11749 [DWApp openURL:myurl options:@{} |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
11750 completionHandler:^(BOOL success) {}]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11751 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11752 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11753 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11754 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11755 * 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
|
11756 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11757 * 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
|
11758 * 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
|
11759 * 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
|
11760 * 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
|
11761 * 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
|
11762 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11763 * 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
|
11764 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11765 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
|
11766 { |
2726
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11767 if(drawfunc) |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11768 { |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11769 UIPrintInfo *pi = [UIPrintInfo alloc]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11770 DWPrintPageRenderer *renderer = [DWPrintPageRenderer new]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11771 NSMutableArray *pa = [[[NSMutableArray alloc] initWithObjects:pi, renderer, nil] retain]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11772 |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11773 if(!jobname) |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11774 jobname = "Dynamic Windows Print Job"; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11775 |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11776 [pi setOutputType:UIPrintInfoOutputGeneral]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11777 [pi setJobName:[NSString stringWithUTF8String:jobname]]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11778 [pi setOrientation:UIPrintInfoOrientationPortrait]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11779 [renderer setDrawFunc:drawfunc]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11780 [renderer setDrawData:drawdata]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11781 [renderer setPages:pages]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11782 [renderer setFlags:flags]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11783 [renderer setPrint:pa]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11784 return pa; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11785 } |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
11786 return NULL; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11787 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11788 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11789 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11790 * 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
|
11791 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11792 * 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
|
11793 * 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
|
11794 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11795 * 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
|
11796 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11797 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
|
11798 { |
2726
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11799 int retval = DW_ERROR_UNKNOWN; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11800 |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11801 if(print) |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11802 { |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11803 NSMutableArray *pa = print; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11804 |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11805 [pa addObject:[NSNumber numberWithUnsignedLong:flags]]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11806 [DWObj safeCall:@selector(printDialog:) withObject:pa]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11807 retval = (int)[[pa lastObject] integerValue]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11808 [pa release]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11809 } |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11810 return retval; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11811 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11812 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11813 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11814 * 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
|
11815 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11816 * 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
|
11817 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11818 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
|
11819 { |
2726
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11820 if(print) |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11821 { |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11822 NSMutableArray *pa = print; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11823 UIPrintInteractionController *pc = [UIPrintInteractionController sharedPrintController]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11824 |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11825 [pc dismissAnimated:YES]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11826 [pa release]; |
7a15401e73f4
iOS: Initial print support for iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2725
diff
changeset
|
11827 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11828 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11829 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11830 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11831 * 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
|
11832 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11833 * 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
|
11834 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11835 * 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
|
11836 * or NULL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11837 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11838 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
|
11839 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11840 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
|
11841 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
|
11842 if(temp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11843 mbstowcs(temp, utf8string, buflen); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11844 return temp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11845 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11846 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11847 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11848 * 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
|
11849 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11850 * wstring: Wide source string. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11851 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11852 * 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
|
11853 * or NULL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11854 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11855 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
|
11856 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11857 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
|
11858 char *temp = malloc(bufflen); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11859 if(temp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11860 wcstombs(temp, wstring, bufflen); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11861 return temp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11862 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11863 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11864 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11865 * 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
|
11866 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11867 * 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
|
11868 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11869 * 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
|
11870 * 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
|
11871 * 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
|
11872 * 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
|
11873 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11874 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
|
11875 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11876 switch(feature) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11877 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11878 case DW_FEATURE_NOTIFICATION: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11879 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
|
11880 case DW_FEATURE_HTML: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11881 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
|
11882 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
|
11883 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
|
11884 case DW_FEATURE_UTF8_UNICODE: |
2771
52f3858035d8
iOS: Change reporting tree widget to be supported.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2770
diff
changeset
|
11885 case DW_FEATURE_TREE: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11886 return DW_FEATURE_ENABLED; |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11887 case DW_FEATURE_DARK_MODE: |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11888 { |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11889 if(DWObj) |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11890 { |
2458
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11891 NSMutableArray *array = [[NSMutableArray alloc] init]; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11892 int retval = DW_FEATURE_UNSUPPORTED; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11893 NSNumber *number; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11894 |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11895 [DWObj safeCall:@selector(getUserInterfaceStyle:) withObject:array]; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11896 number = [array lastObject]; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11897 if(number) |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11898 retval = [number intValue]; |
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11899 return retval; |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11900 } |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11901 return _dw_dark_mode_state; |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11902 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11903 default: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11904 return DW_FEATURE_UNSUPPORTED; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11905 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11906 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11907 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11908 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11909 * 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
|
11910 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11911 * 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
|
11912 * 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
|
11913 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11914 * 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
|
11915 * 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
|
11916 * 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
|
11917 * Remarks: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11918 * 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
|
11919 * 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
|
11920 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11921 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
|
11922 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11923 switch(feature) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11924 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11925 /* 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
|
11926 case DW_FEATURE_NOTIFICATION: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11927 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
|
11928 case DW_FEATURE_HTML: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11929 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
|
11930 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
|
11931 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
|
11932 case DW_FEATURE_UTF8_UNICODE: |
2771
52f3858035d8
iOS: Change reporting tree widget to be supported.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2770
diff
changeset
|
11933 case DW_FEATURE_TREE: |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11934 return DW_ERROR_GENERAL; |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11935 case DW_FEATURE_DARK_MODE: |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11936 { |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11937 /* Make sure DWObj is initialized */ |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11938 if(DWObj) |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11939 { |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11940 /* Disabled forces the non-dark aqua theme */ |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11941 if(state == DW_FEATURE_DISABLED) |
2458
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11942 [DWObj safeCall:@selector(setUserInterfaceStyle:) withObject:[NSNumber numberWithInt:UIUserInterfaceStyleLight]]; |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11943 /* Enabled lets the OS decide the mode */ |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11944 else if(state == DW_FEATURE_ENABLED || state == DW_DARK_MODE_FULL) |
2458
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11945 [DWObj safeCall:@selector(setUserInterfaceStyle:) withObject:[NSNumber numberWithInt:UIUserInterfaceStyleUnspecified]]; |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11946 /* 2 forces dark mode aqua appearance */ |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11947 else if(state == DW_DARK_MODE_FORCED) |
2458
689261c29745
iOS: DWContainer should generate selection event on deselect too.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2457
diff
changeset
|
11948 [DWObj safeCall:@selector(setUserInterfaceStyle:) withObject:[NSNumber numberWithInt:UIUserInterfaceStyleDark]]; |
2456
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11949 } |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11950 else /* Save the requested state for dw_init() */ |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11951 _dw_dark_mode_state = state; |
54f760a257f3
iOS: initial support for iOS Dark Mode... untested. Part 2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2450
diff
changeset
|
11952 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11953 default: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11954 return DW_FEATURE_UNSUPPORTED; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11955 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11956 } |