I'd like to add a opacity slider to the NSColorPanel that is shown for 1 specific NSColorWell. All other color wells should not show the opacity slider.
I know I can set this for the sharedColorPanel like so:
[[NSColorPanel sharedColorPanel] setShowsAlpha:YES];
But how do I do this when I only want this behavior for a single color well?
I tried adding an IBAction, but this IBAction is not called when you click the color well. (So I can't make any changes before the panel is displayed). It is called when you choose another color in the color panel.
OK, here's the code that works. Set the colorwell class in IB to AlphaColorWell:**
@implementation AlphaColorWell
- (void)activate:(BOOL)exclusive
{
[[NSColorPanel sharedColorPanel] setShowsAlpha:YES];
[super activate:exclusive];
}
- (void)deactivate
{
[super deactivate];
[[NSColorPanel sharedColorPanel] setShowsAlpha:NO];
}
@end