diff options
author | Vincent Bénony | 2015-12-04 18:20:09 +0100 |
---|---|---|
committer | Vincent Bénony | 2016-01-06 16:17:33 +0100 |
commit | 638dc113f8c05f121d50e68f68c4e86c130756a4 (patch) | |
tree | cbedc39632929b50063ec4f7df6c181652d83f02 /backends/platform/iphone/iphone_keyboard.mm | |
parent | 124d37247beaffbd48cd1e74c0eec3d4f38dc661 (diff) | |
download | scummvm-rg350-638dc113f8c05f121d50e68f68c4e86c130756a4.tar.gz scummvm-rg350-638dc113f8c05f121d50e68f68c4e86c130756a4.tar.bz2 scummvm-rg350-638dc113f8c05f121d50e68f68c4e86c130756a4.zip |
IOS: Create two targets for old iPhone (iOS <= 6) and new one (iOS >= 7)
The "iphone" backend is the support for the old iPhones.
The "ios7" backend is for the new iPhones.
Diffstat (limited to 'backends/platform/iphone/iphone_keyboard.mm')
-rw-r--r-- | backends/platform/iphone/iphone_keyboard.mm | 45 |
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 |