diff options
author | nyamatongwe <nyamatongwe@gmail.com> | 2013-04-24 19:33:49 +1000 |
---|---|---|
committer | nyamatongwe <nyamatongwe@gmail.com> | 2013-04-24 19:33:49 +1000 |
commit | 60e1f81c03145b6f95c9d1afa2a5c22e4f780659 (patch) | |
tree | ec77f9c0e3b70a5957fb96eedb06a7e0f5d74fb9 /cocoa/ScintillaView.mm | |
parent | 9729603fd826b145cb463a500a1d445b3c6770f8 (diff) | |
download | scintilla-mirror-60e1f81c03145b6f95c9d1afa2a5c22e4f780659.tar.gz |
Feature: [feature-requests:#987]. Cocoa user interface validation.
Diffstat (limited to 'cocoa/ScintillaView.mm')
-rw-r--r-- | cocoa/ScintillaView.mm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index a23a4b8b0..7f6b4991e 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -787,6 +787,28 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) return mOwner.backend->CanRedo(); } +- (BOOL) validateUserInterfaceItem: (id <NSValidatedUserInterfaceItem>) anItem +{ + SEL action = [anItem action]; + if (action==@selector(undo:)) { + return [self canUndo]; + } + else if (action==@selector(redo:)) { + return [self canRedo]; + } + else if (action==@selector(cut:) || action==@selector(copy:) || action==@selector(clear:)) { + return mOwner.backend->HasSelection(); + } + else if (action==@selector(paste:)) { + return mOwner.backend->CanPaste(); + } + return YES; +} + +- (void) clear: (id) sender +{ + [self deleteBackward:sender]; +} - (BOOL) isEditable { |