git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

Cocoa/GBToolbarFieldCell.m

      1 #import "GBToolbarFieldCell.h"
      2 #import <objc/runtime.h>
      3 
      4 @interface NSTextFieldCell()
      5 - (void)textDidChange:(id)sender;
      6 @end
      7 
      8 @implementation GBToolbarFieldCell
      9 
     10 - (void)textDidChange:(id)sender
     11 {
     12     IMP imp = [NSTextFieldCell instanceMethodForSelector:_cmd];
     13     method_setImplementation(class_getInstanceMethod([GBToolbarFieldCell class], _cmd), imp);
     14     ((void(*)(id, SEL, id))imp)(self, _cmd, sender);
     15 }
     16 
     17 - (void)endEditing:(NSText *)textObj
     18 {
     19     IMP imp = [NSTextFieldCell instanceMethodForSelector:_cmd];
     20     method_setImplementation(class_getInstanceMethod([GBToolbarFieldCell class], _cmd), imp);
     21     ((void(*)(id, SEL, id))imp)(self, _cmd, textObj);
     22 }
     23 
     24 - (void)resetSearchButtonCell
     25 {
     26 }
     27 
     28 - (void)resetCancelButtonCell
     29 {
     30 }
     31 
     32 // We only need this hack on Solarium, avoid regressions
     33 + (instancetype)allocWithZone:(struct _NSZone *)zone
     34 {
     35     if (@available(macOS 26.0, *)) {
     36         return [super allocWithZone:zone];
     37     }
     38     return (id)[NSTextFieldCell allocWithZone:zone];
     39 }
     40 @end

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.