File: GBToolbarFieldCell.m

package info (click to toggle)
sameboy 1.0.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 10,528 kB
  • sloc: ansic: 29,948; objc: 22,249; asm: 1,424; pascal: 1,373; makefile: 1,065; xml: 111
file content (40 lines) | stat: -rw-r--r-- 993 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#import "GBToolbarFieldCell.h"
#import <objc/runtime.h>

@interface NSTextFieldCell()
- (void)textDidChange:(id)sender;
@end

@implementation GBToolbarFieldCell

- (void)textDidChange:(id)sender
{
    IMP imp = [NSTextFieldCell instanceMethodForSelector:_cmd];
    method_setImplementation(class_getInstanceMethod([GBToolbarFieldCell class], _cmd), imp);
    ((void(*)(id, SEL, id))imp)(self, _cmd, sender);
}

- (void)endEditing:(NSText *)textObj
{
    IMP imp = [NSTextFieldCell instanceMethodForSelector:_cmd];
    method_setImplementation(class_getInstanceMethod([GBToolbarFieldCell class], _cmd), imp);
    ((void(*)(id, SEL, id))imp)(self, _cmd, textObj);
}

- (void)resetSearchButtonCell
{
}

- (void)resetCancelButtonCell
{
}

// We only need this hack on Solarium, avoid regressions
+ (instancetype)allocWithZone:(struct _NSZone *)zone
{
    if (@available(macOS 26.0, *)) {
        return [super allocWithZone:zone];
    }
    return (id)[NSTextFieldCell allocWithZone:zone];
}
@end