Showing a popup menu in Cocoa
I'm currently writing a neat little Cocoa view that's supposed to pop up one of several menus when clicked, kind of like a menu bar. The trouble is, NSMenu only provides a method to pop up a contextual menu, which is at the mouse location (well, I could doctor the mouse event...) and adds contextual menu plugins (no thanks, those don't belong in my menu).
So, one google later I'd found Jesper's article on popping up a menu using NSCell. This is one of those slightly awkward spots in Cocoa, like drawing an image well: Really, the only way you can draw an image well is by creating a temporary NSImageCell and telling it to draw itself. Similarly, to pop up your menu, you call -performClickWithFrame:inView:.