Re: NSMenuItem and images

2008-04-28 Thread Kristopher Matthews
// size the image for our menu NSSize size; size.width = [[NSFont menuFontOfSize:0] pointSize]; size.height = size.width; This works like a charm. On Apr 28, 2008, at 9:39 AM, Adam R. Maxwell wrote: On Apr 28, 2008, at 7:18 AM, glenn andreas wrote: On Apr 27

Re: NSMenuItem and images

2008-04-28 Thread Adam R. Maxwell
On Apr 28, 2008, at 7:18 AM, glenn andreas wrote: On Apr 27, 2008, at 11:44 PM, Adam R. Maxwell wrote: Sure, but you have no way of knowing what the correct size is for an NSMenuItem (assuming you want a normal size). I set all menu item images to 16x16 since that looks approximately cor

Re: NSMenuItem and images

2008-04-28 Thread glenn andreas
On Apr 27, 2008, at 11:44 PM, Adam R. Maxwell wrote: On Apr 27, 2008, at 9:29 PM, Seth Willits wrote: On Apr 27, 2008, at 4:03 PM, Kristopher Matthews wrote: I have an NSPopUpButton populated with some NSMenuItems that have images. I'm trying to determine the proper dimensions for the i

Re: NSMenuItem and images

2008-04-28 Thread Adam R. Maxwell
On Apr 28, 2008, at 7:00 AM, Hamish Allan wrote: On Mon, Apr 28, 2008 at 2:48 PM, Adam R. Maxwell <[EMAIL PROTECTED]> wrote: I just don't trust that method, since the main menu bar has always looked taller than a menu item, and it could easily change without changing menu item height.

Re: NSMenuItem and images

2008-04-28 Thread Hamish Allan
On Mon, Apr 28, 2008 at 2:48 PM, Adam R. Maxwell <[EMAIL PROTECTED]> wrote: > I just don't trust that method, since the main menu bar has always looked > taller than a menu item, and it could easily change without changing menu > item height. What I want is something akin to -[NSMenuView > rectO

Re: NSMenuItem and images

2008-04-28 Thread Adam R. Maxwell
On Apr 28, 2008, at 6:33 AM, Hamish Allan wrote: On Mon, Apr 28, 2008 at 2:21 PM, Adam R. Maxwell <[EMAIL PROTECTED]> wrote: It's documented to return 0 for all menus except -[NSApp mainMenu]. Maybe all other items are the same height as the main menu? Even if not, it's probably still

Re: NSMenuItem and images

2008-04-28 Thread Kristopher Matthews
Thanks for all the help. What I'm doing now is [[NSApp menu] menuBarHeight]. I find that I still have to subtract some hard coded value (6 is what I picked) - because of course I want the image contained in the menu, not sticking out. That said, I feel much better about hardcoding that vs.

Re: NSMenuItem and images

2008-04-28 Thread Hamish Allan
On Mon, Apr 28, 2008 at 2:21 PM, Adam R. Maxwell <[EMAIL PROTECTED]> wrote: > It's documented to return 0 for all menus except -[NSApp mainMenu]. Maybe > all other items are the same height as the main menu? Even if not, it's probably still a better bet than hard-coding it... Hamish __

Re: NSMenuItem and images

2008-04-28 Thread Adam R. Maxwell
On Apr 28, 2008, at 5:28 AM, Kristopher Matthews wrote: I gave that a try, but it seems to always return 0. It's documented to return 0 for all menus except -[NSApp mainMenu]. Maybe all other items are the same height as the main menu? After googling, it's a seemingly common problem that

Re: NSMenuItem and images

2008-04-28 Thread Kristopher Matthews
I gave that a try, but it seems to always return 0. After googling, it's a seemingly common problem that's been around for while. That said [NSMenuView menuBarHeight] does work (returning 22) - but is marked deprecated in the documentation. On Apr 28, 2008, at 7:12 AM, Hamish Allan wrote:

Re: NSMenuItem and images

2008-04-28 Thread Hamish Allan
On Mon, Apr 28, 2008 at 12:39 PM, Kristopher Matthews <[EMAIL PROTECTED]> wrote: > I don't see any way to do it, but my initial concern is that user could > modify their system to change that height - maybe for visually impaired > users. You could perhaps use [[yourPopupButton menu] menuBarHeight

Re: NSMenuItem and images

2008-04-28 Thread Kristopher Matthews
I don't see any way to do it, but my initial concern is that user could modify their system to change that height - maybe for visually impaired users. Also, as Adam points out - there's no guarantee that this height will not change in a future release. Oh well, #define kMenuItemImageSize

Re: NSMenuItem and images

2008-04-27 Thread Adam R. Maxwell
On Apr 27, 2008, at 9:29 PM, Seth Willits wrote: On Apr 27, 2008, at 4:03 PM, Kristopher Matthews wrote: I have an NSPopUpButton populated with some NSMenuItems that have images. I'm trying to determine the proper dimensions for the image. I'm getting the image from [NSWorkspace: iconForFi

Re: NSMenuItem and images

2008-04-27 Thread Seth Willits
On Apr 27, 2008, at 4:03 PM, Kristopher Matthews wrote: I have an NSPopUpButton populated with some NSMenuItems that have images. I'm trying to determine the proper dimensions for the image. I'm getting the image from [NSWorkspace: iconForFile], which appears to be returning them at 32x32,

NSMenuItem and images

2008-04-27 Thread Kristopher Matthews
I have an NSPopUpButton populated with some NSMenuItems that have images. I'm trying to determine the proper dimensions for the image. I'm getting the image from [NSWorkspace: iconForFile], which appears to be returning them at 32x32, much too large. Manually resizing to 16x16 works well, b