CCMArea is a packages of classes for adding contextual
menu support to PowerPlant applications. They are designed
to conform to Apple's guidelines and to give the developer
control over the contents of the menus.
Version 1.5 takes advantage of new features in PowerPlant
There are several classes, CCMArea being the main one. It's
a mix-in class to add to your pane classes. There are also
LWindow and LDialogBox subclasses and an LApplication subclass,
all of which you can either use or imitate.
The design supports submenus, CMs in inactive windows, and
building menus according to an object hierarchy - for example,
a text field could add Cut, Copy, and Paste, and then the window
that contains it could add Close Window (but only if you want
If you want to see CCMArea in action, check out the control
panel that comes with StuffCM, as well as the latest version
of Icon Machine.
PowerPlant 1.9.1 has added contextual menu support in the form
of the LCMAttachment class. This does not mean that CCMArea
is now obsolete; each solution has its advantages and disadvantages.
Put simply, LCMAttachment is easier to use, while CCMArea
can give you more power and flexibility. More specifically:
Because LCMAttachment is implemented as an attachment, it
requires almost no code changes to use, and you configure it
in Constructor. But if you want something beyond the core functionality
provided, such as submenus or handling the Help command, you
will have to subclass.
CCMArea is a mix-in class, and so it's implemented and configured
entirely in code. However, it is free from the restrictions
that attachments have. For example, this makes possible building
menus through the object hierarchy as mentioned above.
Both implementations make selection data available to CM plugins
and follow all of Apple's interface guidelines for contextual
menus. CMs in floating windows is a potential problem in either
case, but this is due to a limitation in PowerPlant itself.
A friendly warning
If you're doing contextual menus on your own, I just thought
I'd share something I learned about the ContextualMenuClick
call. If you give it a menu with command IDs set (using the
SetMenuItemCommandID call), those command IDs will be gone
when ContextualMenuClick returns. Submenus, fortunately,
are unaffected. I have heard that this bug is fixed in Appearance