GCWindowMenu is a free utility that offers a simple solution to turning any view into a pop-up menu. Includes example code to show use with a standard NSSlider.
How it works: You create an instance of GCWindowMenu, then you add the main content view to it (a slider control, or whatever you like - in fact the creation of the window and supplying the view is one class method call), then you call one class method to handle the rest - positioning it, popping it up on screen, tracking it and then finally fading it away quickly but gracefully at the end.
GCWindowMenu endeavours to emulate the standard menu behaviour - if you click once quickly to bring it up, it will stay on screen and you can click and drag in it. If you click and hold, it will stay up as long as the mouse is down.
Standard view mouse event handling methods are called while the menu is being tracked, so by and large you can easily design a view to work in any situation - in a window or in a menu. For standard control views, there are a few additional minor kinks, since those views implement their own tracking loops. At present their design means that depending on how you position the menu, you may not be able to use the click-hold-release method with some kinds of controls. GCWindowMenu tries to do the right thing, and has some flags you can set to change the behaviour.
GCWindowMenu only implements the menu, not the widget that triggers it. However, the example code in the download shows one simple way to handle this - as you'll see it's just a very small effort.
Requirements:
· Xcode