aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/iphone/iphone_keyboard.mm
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/iphone/iphone_keyboard.mm')
-rw-r--r--backends/platform/iphone/iphone_keyboard.mm45
1 files changed, 21 insertions, 24 deletions
diff --git a/backends/platform/iphone/iphone_keyboard.mm b/backends/platform/iphone/iphone_keyboard.mm
index 0588aac8ab..39d68aff81 100644
--- a/backends/platform/iphone/iphone_keyboard.mm
+++ b/backends/platform/iphone/iphone_keyboard.mm
@@ -43,13 +43,31 @@
self = [super initWithFrame:CGRectMake(0.0f, 0.0f, 0.0f, 0.0f)];
softKeyboard = keyboard;
- [self setAutocorrectionType:UITextAutocorrectionTypeNo];
- [self setAutocapitalizationType:UITextAutocapitalizationTypeNone];
- [self setEnablesReturnKeyAutomatically:NO];
+ [[self textInputTraits] setAutocorrectionType:(UITextAutocorrectionType)1];
+ [[self textInputTraits] setAutocapitalizationType:(UITextAutocapitalizationType)0];
+ [[self textInputTraits] setEnablesReturnKeyAutomatically:NO];
return self;
}
+- (void) keyboardInputShouldDelete:(id)input {
+ [softKeyboard handleKeyPress:0x08];
+}
+
+- (BOOL)webView:(id)fp8 shouldInsertText:(id)character
+ replacingDOMRange:(id)fp16
+ givenAction:(int)fp20 {
+
+ if ([character length] != 1) {
+ [NSException raise:@"Unsupported" format:@"Unhandled multi-char insert!"];
+ return NO;
+ }
+
+ [softKeyboard handleKeyPress:[character characterAtIndex:0]];
+
+ return NO;
+}
+
@end
@@ -59,22 +77,9 @@
self = [super initWithFrame:frame];
inputDelegate = nil;
inputView = [[TextInputHandler alloc] initWithKeyboard:self];
- inputView.delegate = self;
return self;
}
-- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
- unichar c;
- if (text.length) {
- c = [text characterAtIndex:0];
- }
- else {
- c = '\b';
- }
- [inputDelegate handleKeyPress:c];
- return YES;
-}
-
- (UITextView *)inputView {
return inputView;
}
@@ -87,12 +92,4 @@
[inputDelegate handleKeyPress:c];
}
-- (void)showKeyboard {
- [inputView becomeFirstResponder];
-}
-
-- (void)hideKeyboard {
- [inputView endEditing:YES];
-}
-
@end