The application window contains a Custom View object (class set to MyView). The main menu contains a Font Menu Item (NSMenuItem), and there is a object called Font Manager (NSFontManager). The only connection that is needed is to make the Font Manager a target of the Show Fonts Menu Item, such that it receives the action "orderFrontFontPanel."
Now, when the User clicks on Font => Show Fonts, the Font Manager handles the interaction, and if the font changes, it calls "changeFont_" which is sent to the First Responder. To deal with a request to change the font, all we need is something like this:
class MyView(NSView): |
I think what it does is so obvious that we don't need a screenshot. Of course, we could make things a lot more complicated. At the moment, none of the other items in the Font Menu is active.