Hi,
Normally in OS X apps, if you unfocus your app's window, e.g. by clicking on the desktop, buttons / toolbars / other controls will change their appearance (it looks as if they were shaded by a light gray or something...).
When I subclass e.g. NSButtonCell, how do I check if it is in its normal state or in this gray / shaded state?
Thanks,
-ranguvar
EDIT: Okay, here's how you do it:
In your drawRect: (or corresponding) method, include the following:
Normally in OS X apps, if you unfocus your app's window, e.g. by clicking on the desktop, buttons / toolbars / other controls will change their appearance (it looks as if they were shaded by a light gray or something...).
When I subclass e.g. NSButtonCell, how do I check if it is in its normal state or in this gray / shaded state?
Thanks,
-ranguvar
EDIT: Okay, here's how you do it:
In your drawRect: (or corresponding) method, include the following:
Code:
if (self == [[self window] firstResponder]
&& [[self window] isMainWindow]
&& [[self window] isKeyWindow])
{
// Draw focused version.
}
else {
// Draw unfocused version.
}