NSSliderCell, lockFocus question
NSSliderCell, lockFocus question
- Subject: NSSliderCell, lockFocus question
- From: Frederik Slijkerman <email@hidden>
- Date: Mon, 13 Apr 2009 22:30:24 +0200
Hi all,
This is my first question here. I'm trying to port a cross-platform app
to OS X using Cocoa. I've already got good results so far, but sometimes
it's difficult to find out how things are supposed to work.
Currently I'm porting a custom slider control that needs to draw parts
of the its interface, like the slider bar and the knob, in the OS style.
The code that I currently have draws this to a temporary bitmap to avoid
flicker on Windows and I'd like to keep it like this as much as possible
to avoid forking the code too much.
It looks like NSSliderCell will be able to draw the necessary parts, but
the documentation says that you need to call lockFocus on the view that
you want to draw to first. But I would like to draw in a CGContextRef
that I have which draws into a bitmap. Now I'm wondering what lockFocus
on NSView does exactly. Does it just activate a graphics context that
works on this view?
Specifically, would it work to do:
NSGraphicsContext *gc = [NSGraphicsContext contextWithGraphicsPort:
myCGContextRef];
[NSGraphicsContext setCurrentContext:gc];
to get NSSliderCell to draw into any custom CGContextRef?
Thanks for any comments!
Best regards,
Frederik Slijkerman
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden