diff --git a/Cocoa/Document.xib b/Cocoa/Document.xib index a91837d..47b8a4a 100644 --- a/Cocoa/Document.xib +++ b/Cocoa/Document.xib @@ -748,7 +748,7 @@ - + @@ -760,7 +760,7 @@ - + diff --git a/Cocoa/GBDeleteButtonCell.h b/Cocoa/GBDeleteButtonCell.h new file mode 100644 index 0000000..7a2c1e2 --- /dev/null +++ b/Cocoa/GBDeleteButtonCell.h @@ -0,0 +1,9 @@ +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface GBDeleteButtonCell : NSButtonCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/Cocoa/GBDeleteButtonCell.m b/Cocoa/GBDeleteButtonCell.m new file mode 100644 index 0000000..97e3470 --- /dev/null +++ b/Cocoa/GBDeleteButtonCell.m @@ -0,0 +1,30 @@ +#import "GBDeleteButtonCell.h" + +@implementation GBDeleteButtonCell + +// Image scaling is broken on some older macOS versions +- (void)drawImage:(NSImage *)image withFrame:(NSRect)frame inView:(NSView *)controlView +{ + double size = 13; + unsigned offset = 1; + if (@available(macOS 10.10, *)) { + size = 15; + offset = 0; + } + frame.origin.x += round((frame.size.width - size) / 2) + offset; + frame.origin.y += round((frame.size.height - size) / 2) - offset; + frame.size.width = frame.size.height = size; + [super drawImage:image withFrame:frame inView:controlView]; +} + +- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView +{ + [self drawImage:self.image withFrame:cellFrame inView:controlView]; +} + +-(void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView +{ + +} + +@end