mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-04 18:03:41 +00:00
Fixed: arrow cursor when the cursor is hover a CPTextField
Previously, when the cursor was hover a CPTextField the cursor was an arrow till we selected the textField. Now when the cursor is hover a CPTextField, and if this textField is enabled and editable or selectable we show the selecting cursor. This is the default behavior in Cocoa as well. Updated manual test Tests/Manual/CPTextField/
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
|
||||
@global CPApp
|
||||
@global CPStringPboardType
|
||||
@global CPCursor
|
||||
|
||||
|
||||
@protocol CPTextFieldDelegate <CPControlTextEditingDelegate>
|
||||
@@ -981,6 +982,22 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
return [[[anEvent window] platformWindow] _propagateCurrentDOMEvent:YES];
|
||||
}
|
||||
|
||||
- (void)mouseEntered:(CPEvent)anEvent
|
||||
{
|
||||
[super mouseEntered:anEvent];
|
||||
|
||||
if ([self isEnabled] && ([self isSelectable] || [self isEditable]))
|
||||
[[CPCursor IBeamCursor] set];
|
||||
}
|
||||
|
||||
- (void)mouseExited:(CPEvent)anEvent
|
||||
{
|
||||
[super mouseExited:anEvent];
|
||||
|
||||
// Make sure to have the arrow cursor when leaving a textField
|
||||
[[CPCursor arrowCursor] set];
|
||||
}
|
||||
|
||||
- (void)keyUp:(CPEvent)anEvent
|
||||
{
|
||||
if (!([self isEnabled] && [self isEditable]))
|
||||
|
||||
@@ -50,8 +50,13 @@
|
||||
[shadowLabel setFrame:CGRectMake(15, CGRectGetMaxY([textField frame]) + 10, 300, 18)];
|
||||
[championOfLightLabel setFrame:CGRectMake(15, CGRectGetMaxY([shadowLabel frame]) + 2, 300, 18)];
|
||||
|
||||
var selectableLabel = [CPTextField labelWithTitle:@"This text should be selectable and you should see the selectable cursor."];
|
||||
[selectableLabel setSelectable:YES];
|
||||
[selectableLabel setFrame:CGRectMake(15, CGRectGetMaxY([championOfLightLabel frame]) + 8, 600, 18)];
|
||||
|
||||
[contentView addSubview:shadowLabel];
|
||||
[contentView addSubview:championOfLightLabel];
|
||||
[contentView addSubview:selectableLabel];
|
||||
|
||||
var jumpLabel = [CPTextField labelWithTitle:@"The text of these text fields should not move ('jump') when a field becomes the first responder. Labels on the right should replicate the input."];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user