|
From: | David Chisnall |
Subject: | Re: NSMenuItem and NSValidatedUserInterfaceItem |
Date: | Tue, 6 Jan 2009 11:29:30 +0000 |
On 6 Jan 2009, at 11:06, Fred Kiefer wrote:
To be honest, I don't see any potential use for the protocol itself. Weneed to have an abstraction for the menu representation, but this is already there. Why would anybody use menu items that aren't of a subclass of NSMenuItem?
This is Objective-C, not C++. Types are just there as a hint to help static error checking - there is nothing stopping you passing something that isn't an NSMenuItem, but acts like one, to something that expects an NSMenuItem. My recommendation would be to track the Apple changes, since it makes porting from Cocoa easier, and because it makes for people who use the Apple docs as a reference (e.g. me).
If we want to use something that isn't an NSMenuItem in future, we just need an explicit cast and to make sure we implement all of the public methods of NSMenuItem (which we'd need to do anyway with the protocol).
David
[Prev in Thread] | Current Thread | [Next in Thread] |