comparison src/video/uikit/SDL_uikitview.m @ 2405:3d0b3a7d3bea gsoc2008_iphone

Added keyboard support in view initialization and proper deallocation of keyboard in -(void)dealloc, if keyboard is enabled
author Holmes Futrell <hfutrell@umail.ucsb.edu>
date Tue, 29 Jul 2008 17:19:23 +0000
parents e9a1eed243c9
children ab89ff6e97af
comparison
equal deleted inserted replaced
2404:18cb44c5b221 2405:3d0b3a7d3bea
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 18
19 Sam Lantinga 19 Sam Lantinga
20 slouken@libsdl.org 20 slouken@libsdl.org
21 */ 21 */
22
22 #import "SDL_uikitview.h" 23 #import "SDL_uikitview.h"
24 #import "SDL_uikitkeyboard.h"
23 25
24 @implementation SDL_uikitview 26 @implementation SDL_uikitview
25 27
26 - (void)dealloc { 28 - (void)dealloc {
29 #if SDL_IPHONE_KEYBOARD
30 [textField release];
31 #endif
27 [super dealloc]; 32 [super dealloc];
28 } 33 }
29 34
30 - (id)initWithFrame:(CGRect)frame { 35 - (id)initWithFrame:(CGRect)frame {
31 36
32 self = [super initWithFrame: frame]; 37 self = [super initWithFrame: frame];
33 38
39 #if SDL_IPHONE_KEYBOARD
40 [self initializeKeyboard];
41 #endif
42
34 int i; 43 int i;
35 for (i=0; i<MAX_SIMULTANEOUS_TOUCHES; i++) { 44 for (i=0; i<MAX_SIMULTANEOUS_TOUCHES; i++) {
36 mice[i].driverdata = NULL; 45 mice[i].driverdata = NULL;
37 SDL_AddMouse(&(mice[i]), i); 46 SDL_AddMouse(&(mice[i]), i);
38 } 47 }
39 self.multipleTouchEnabled = YES; 48 self.multipleTouchEnabled = YES;
40 49
41 return self; 50 return self;
42 51
43 } 52 }
44 53
45 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 54 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
93 } 102 }
94 103
95 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { 104 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
96 /* 105 /*
97 this can happen if the user puts more than 5 touches on the screen 106 this can happen if the user puts more than 5 touches on the screen
98 at once, or perhaps in other circumstances. Usually all active 107 at once, or perhaps in other circumstances. Usually (it seems)
99 touches are canceled. 108 all active touches are canceled.
100 */ 109 */
101 [self touchesEnded: touches withEvent: event]; 110 [self touchesEnded: touches withEvent: event];
102 } 111 }
103 112
104 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 113 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
116 } 125 }
117 } 126 }
118 } 127 }
119 } 128 }
120 129
130
131
121 @end 132 @end