Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSMenuItem height?

How can I change the height of an NSMenuItem? When I change the font of a menu, an NSMenuItem automatically resizes to just fit the title, leaving no space above or below the title. It looks very cramped.

Looks like this:

enter image description here

Want it to look like this:

enter image description here

I've tried a million tweaks related to the attributed title of the menu items, but to no avail. I also don't want to use the view property of the menu items because I want to keep the highlight. Any other ideas?

Edit: This is what I'd like (more or less), but based on NSMenu, not redoing it from the ground up.

enter image description here

like image 745
danjonweb Avatar asked Aug 03 '13 10:08

danjonweb


1 Answers

You can set an empty 1-pixel wide image with the desired height:

NSImage *image=[[NSImage alloc]initWithSize:NSMakeSize(1,30)];

[menuItem setImage:image];

Obviously you end up with titles that are offset 1 pixel to the right, though that may be acceptable if uniformly applied.

like image 64
Gerd K Avatar answered Sep 29 '22 09:09

Gerd K