mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
New: grey out Edit menu non applicable items for text fields.
Copy, cut and delete are now disabled if there's no selection in the active text field. Cut, paste and delete are greyed out if the text field is not editable (a label). Refs #1964.
This commit is contained in:
@@ -1765,6 +1765,23 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
[self _becomeFirstKeyResponder];
|
||||
}
|
||||
|
||||
- (BOOL)validateUserInterfaceItem:(id <CPValidatedUserInterfaceItem>)anItem
|
||||
{
|
||||
var theAction = [anItem action];
|
||||
|
||||
if (![self isEditable] && (theAction == @selector(cut:) || theAction == @selector(paste:) || theAction == @selector(delete:)))
|
||||
return NO;
|
||||
|
||||
// FIXME - [self selectedRange] is always empty if we're not an editable field, so we must assume yes here.
|
||||
if (![self isEditable])
|
||||
return YES;
|
||||
|
||||
if (theAction == @selector(copy:) || theAction == @selector(cut:) || theAction == @selector(delete:))
|
||||
return [self selectedRange].length;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark Private
|
||||
|
||||
- (BOOL)_isWithinUsablePlatformRect
|
||||
|
||||
Reference in New Issue
Block a user