On 21 Feb 2009, at 10:30, Truls Becken wrote:

Well, then the application would have to set up the menu for each
context. This is already possible, but not used extensively in the
NeXT tradition. Try right-clicking a file in GWorkspace for instance.
The application menu is shown where no context menu is set.

I've not tried this on GNUstep, but on OS X the menu is displayed automatically on right click if the view's menu attribute is defined (either in IB or be calling -setMenu: ) or the view responds to +defaultMenu.

You can make any view that doesn't define it's own custom context menu display the main menu as its context menu by adding this category:

@implementation NSView (ContextMainMenu)
+ (NSMenu*) defaultMenu
{
        return [NSApp mainMenu];
}
@end

This looks slightly weird on OS X because the app name in the menu is filled in automatically in the menu bar, but not as a context menu.

I was under the impression that this is the default behavior in GNUstep, but maybe I'm wrong. I'll need to fire up the NeXTStation to check[1], but I think it worked like this on NeXTSTEP 3.3.

David

[1] If anyone's interested in comparing behavior, I can get the NeXTstation out of the history of computing collection's archive for the Étoilé hackathon.

_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to