Add -insertTabIgnoringFieldEditor: and -insertNewlineIgnoringFieldEditor:

This commit is contained in:
Andreas
2010-11-13 15:16:25 +01:00
committed by Andreas Falk
parent 17b40fcb9d
commit 9b7f8ec31e
+38
View File
@@ -715,6 +715,25 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
[[[self window] platformWindow] _propagateCurrentDOMEvent:NO];
}
- (void)insertNewlineIgnoringFieldEditor:(id)sender
{
var oldValue = [self stringValue];
[self _inputElement].value += CPNewlineCharacter;
[self _setStringValue:[self _inputElement].value];
if (oldValue !== [self stringValue])
{
if (!_isEditing)
{
_isEditing = YES;
[self textDidBeginEditing:[CPNotification notificationWithName:CPControlTextDidBeginEditingNotification object:self userInfo:nil]];
}
[self textDidChange:[CPNotification notificationWithName:CPControlTextDidChangeNotification object:self userInfo:nil]];
}
}
- (void)selectNextKeyView:(id)sender
{
[[self window] selectNextKeyView:self];
@@ -740,6 +759,25 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
[self selectNextKeyView:sender];
}
- (void)insertTabIgnoringFieldEditor:(id)sender
{
var oldValue = [self stringValue];
[self _inputElement].value += CPTabCharacter;
[self _setStringValue:[self _inputElement].value];
if (oldValue !== [self stringValue])
{
if (!_isEditing)
{
_isEditing = YES;
[self textDidBeginEditing:[CPNotification notificationWithName:CPControlTextDidBeginEditingNotification object:self userInfo:nil]];
}
[self textDidChange:[CPNotification notificationWithName:CPControlTextDidChangeNotification object:self userInfo:nil]];
}
}
- (void)insertBacktab:(id)sender
{
[self selectPreviousKeyView:sender];