nscolorwell

How to change the action of NSColorWell?

情到浓时终转凉″ 提交于 2019-12-25 18:02:21
问题 I can use NSColorWell as button to change the color of selected text. Since NSColorWell is object of an NSControl it has target and action. I guess, the action is implementing the code to change the color of the selected text in NSTextView. Where can I find this code for NSColorWell action? I would like to change it in away that I can use NSColorWell to change the background of the selected text, and ultimately to have in ToolBar two NSColorWell buttons: one to change text's foreground color

Add opacity slider to the color panel for one color well but not others

北城以北 提交于 2019-12-23 07:29:21
问题 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