mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 21:17:03 +00:00
This PR adds a new feature for CPControl. Now when leaving the control, the userInfo of the notification CPTextDidEndEditingNotification contains the last movements of the control as in COCOA Test app in Tests/Manual/CPTextFieldMovementsTest
47 lines
875 B
Plaintext
47 lines
875 B
Plaintext
/*
|
|
* CustomTextField.j
|
|
* CPTextFieldMovementsTest
|
|
*
|
|
* Created by Alexandre Wilhelm on October 29, 2013.
|
|
*/
|
|
|
|
@import <Foundation/Foundation.j>
|
|
@import <AppKit/CPTextField.j>
|
|
|
|
@implementation CustomTextField : CPTextField
|
|
{
|
|
}
|
|
|
|
- (id)init
|
|
{
|
|
if (self = [super init])
|
|
{
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)keyDown:(CPEvent)anEvent
|
|
{
|
|
var key = [anEvent charactersIgnoringModifiers];
|
|
|
|
if (key == CPLeftArrowFunctionKey)
|
|
{
|
|
[[self window] makeFirstResponder:[self previousKeyView]];
|
|
return;
|
|
}
|
|
|
|
if (key == CPRightArrowFunctionKey ||
|
|
key == CPUpArrowFunctionKey ||
|
|
key == CPDownArrowFunctionKey ||
|
|
key == CPEscapeFunctionKey ||
|
|
[anEvent keyCode] == CPReturnKeyCode)
|
|
{
|
|
[[self window] makeFirstResponder:[self nextKeyView]];
|
|
return;
|
|
}
|
|
|
|
[super keyDown:anEvent];
|
|
}
|
|
|
|
@end
|