You should get the start of the template phase according to your perspective.
That is, selectedMenuItemColor is actually a template, not a color, and this template is designed to display "correctly" in the "standard increase the height of the menu item." Since you added the add-on, now it does not appear in the "standard" location.
Try the following:
-(void) drawRect:(NSRect)dirtyRect { CGRect b = self.bounds; if (selected) { NSPoint origin = [self frame].origin; curContext = [NSGraphicsContext currentContext]; [curContext saveGraphicsState]; [curContext setPatternPhase: origin]; [[NSColor selectedMenuItemColor] set]; NSRectFill( b ); [curContext restoreGraphicsState]; if (textField) { textField.textColor = [NSColor selectedMenuItemTextColor]; } } else { [[NSColor clearColor] set]; NSRectFillUsingOperation(b, NSCompositeSourceOver); if (textField) { textField.textColor = [NSColor blackColor]; } } }
source share