[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSPopUpButton related new patches
From: |
Nicola Pero |
Subject: |
Re: NSPopUpButton related new patches |
Date: |
Thu, 30 Jan 2003 03:41:29 +0000 (GMT) |
> NP> > Another question is: when item has key equivalent and selected
> NP> > (displaying NSPopUpButton image on the right side (i don't know
> NP> > how it named) after mouse button up). In OpenStep it isn't. Is it
> NP> > responsibility of application or AppKit to remove key equivalent
> NP> > while item stays visible?
> NP>
> NP> If you are talking about the small icon on the right of the popup
> NP> button being drawn over the key equivalent of the currently selected
> NP> item(which is not very pretty), I think it's a bug in gnustep-gui.
> NP>
> NP> In other words, yes, I think it's definitely
> NP> gnustep-gui's responsibility to make sure things are displayed
> NP> properly :-) and images are not drawn over key equivalents :-) it's
> NP> a bug we need to fix.
>
> Now it's fixed (NSMenuItemCell.m.patch). It's also moves code that
> drawing right arrow from drawKeyEquivalentWithFrame: into
> drawImageWithFrame: so key equivalent draws only if no image (right
> arrow in menu or any other like in NSPopUpButton).
Interesting.
<looking at the code>
Hmmm - there is a trick here. :-)
You can set an image for a NSMenuItem; for example -
[[[NSApplication mainMenu] itemWithTitle: @"Quit"] setImage: [NSImage
imageNamed: @"Smiley"]];
then, in the main menu you see
(*) Quit q
where (*) is the Smiley image.
But GNUstep allows you to do more ... you can set an image for a
NSMenuItem even if it has a submenu :-)
[[[NSApplication mainMenu] itemWithTitle: @"Edit"] setImage: [NSImage
imageNamed: @"Smiley"]];
then, in the main menu you see
(*) Edit ->
where (*) is the Smiley image.
This feature is nice ... I'm not sure if we want to loose it.
This feature is why the '->' image of menu items with submenus is drawn as
if it were a key equivalent (effectively, it graphically replaces the key
equivalent). It can't be drawn in the actual 'drawImage:' method, as that
method is used to draw the (optional) menuItem image.
Of course we need to fix the bug.
Any ideas of how to do ? We might drop the 'feature' of having an image
for menu items having submenus if really there is no better way out.
> The second(NSMenuView.m.patch) is just removes extra 17 pixels
> between menu item text and key equivalent (or right arrow). Now
> menu looks almost(2 pixels still left :)) like NeXT/OpenStep's menu
> and it saves more screen space remaining handy and usable.
Thanks - applied - this change is very nice - menus look better :-)
> PS: I've got reply from gnu.org and waiting for copyright assignment by
> mail. It takes 10-14 days I guess.
Thanks