I'm trying to create a submenu for one of my menu items that is dynamically generated (listing the items in an NSMutableDictionary) for the current document. I'm not completely sure how to go about this, but I'm guessing subclassing NSMenu is what I want to be doing and adding a new NSMenuItem for each object in the dictionary. I'd like the new menu items for the contents of the submenu to be generated every time the submenu is accessed (as in when the parent NSMenuItem/NSMenu is clicked).
My main problems right now are figuring out whether it is NSMenu or NSMenuItem I want to subclass, and which method I want to override to add in the generation behaviour. Can anyone help?
I'm also a bit confused about how my menu accesses the current document - is this via the first responder? How would I refer to the first responder in code?
My main problems right now are figuring out whether it is NSMenu or NSMenuItem I want to subclass, and which method I want to override to add in the generation behaviour. Can anyone help?
I'm also a bit confused about how my menu accesses the current document - is this via the first responder? How would I refer to the first responder in code?