123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- //
- // NSTextField+Layer.swift
- // PDF Master
- //
- // Created by lizhe on 2023/2/16.
- //
- import Foundation
- extension NSTextField {
- open override var focusRingType: NSFocusRingType {
- get {.none}
- set {}
- }
-
- // - (void)mouseDown:(NSEvent *)event {
- // [super mouseDown:event];
- //
- // if ([self currentEditor]) {
- // if ([self.delegate respondsToSelector:@selector(customTextFieldWillBeginEditing:)])
- // [(id<CustomTextFieldDelegate>)self.delegate customTextFieldWillBeginEditing:self];
- // }
- // }
- //
- // - (BOOL)becomeFirstResponder {
- // BOOL success = [super becomeFirstResponder];
- // if(success) {
- // NSTextView * textView = (NSTextView *)[self currentEditor];
- //
- // if([textView respondsToSelector:@selector(setInsertionPointColor:)]) {
- //
- // [textView setInsertionPointColor:[NSColor whiteColor]];
- //
- // }
- //
- // }
- //
- // return success;
- // }
- //
- // - (BOOL)performKeyEquivalent:(NSEvent *)event {
- // NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard];
- // if (([event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask) == NSEventModifierFlagCommand) {
- // // The command key is the ONLY modifier key being pressed.
- // if ([[event charactersIgnoringModifiers] isEqualToString:@"x"] &&
- // [[[self window] firstResponder] respondsToSelector:@selector(cut:)]) {
- // return [NSApp sendAction:@selector(cut:) to:[[self window] firstResponder] from:self];
- // } else if ([[event charactersIgnoringModifiers] isEqualToString:@"c"] &&
- // [[[self window] firstResponder] respondsToSelector:@selector(copy:)]) {
- // return [NSApp sendAction:@selector(copy:) to:[[self window] firstResponder] from:self];
- // } else if ([[event charactersIgnoringModifiers] isEqualToString:@"v"] &&
- // [[[self window] firstResponder] respondsToSelector:@selector(paste:)] &&
- // [pasteBoard stringForType:NSPasteboardTypeString] != nil) {
- // return [NSApp sendAction:@selector(paste:) to:[[self window] firstResponder] from:self];
- // } else if ([[event charactersIgnoringModifiers] isEqualToString:@"a"] &&
- // [[[self window] firstResponder] respondsToSelector:@selector(selectAll:)]) {
- // return [NSApp sendAction:@selector(selectAll:) to:[[self window] firstResponder] from:self];
- // }
- // }
- //
- // return [super performKeyEquivalent:event];
- // }
- }
|