On Nov 5, 2014, at 5:53 PM, Wim Lewis <w...@omnigroup.com> wrote:

> 
> On Nov 5, 2014, at 3:43 PM, Alex Kac <a...@webis.net> wrote:
>> BUT, in this case I’m just trying to get the glow on selected images, so 
>> when I look at the code below all I see is that we’re getting the bitmap and 
>> drawing it. I’m not understanding how that gets a glow.
> 
> 
> It’s applied by NSButtonCell, which knows that if it’s in the selected state 
> and its image is marked as a template image (or some set of conditions like 
> that), then it should apply the glow when drawing.
> 
> I take it you’re trying to get this effect in some place other than inside a 
> button? It’s not unreasonable to use an NSCell instance elsewhere— that’s 
> essentially what cells are for, to abstract away some of the drawing behavior 
> from the control view that uses them.
> 
> I think NSButtonCell uses NSSetFocusRingStyle() to provide the actual effect, 
> but there may be additional magic in there.

If it's the blue that toolbar buttons apply to template images, it's not using 
that - I don't know what it is, but they were only fuzzy in the first OS that 
used them, and even then they used something else. There's also an etched 
effect it gets, depending on which OS you're in. I sent Alex a sample app that 
puts everything together.

But yes, for fuzzy blue around an icon, all you have to do is call 
NSSetFocusRingStyle before drawing it. This doesn't change the icon colors, 
though.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to