• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSliderCell, lockFocus question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSliderCell, lockFocus question


  • Subject: Re: NSSliderCell, lockFocus question
  • From: Frederik Slijkerman <email@hidden>
  • Date: Tue, 14 Apr 2009 08:48:31 +0200

Hi Uli,

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.

If you can, get the codebase changed in some way that you can get rid of the Windows code that isn't needed on the Mac, e.g. by adding additional abstractions. It'll hurt much less in the long run.

I understand, but forking the code will hurt a lot, too. :-)

That's what it basically does, so yes, this should work. That said, many cells expect to be hosted inside a view, and I'm not sure they'll work as well in any other graphics context. The main reason for cells to exist is not to draw outside views, but rather to support things like NSTableView, NSMatrix etc., where you draw several cells in a single view for efficiency reasons.

OK, thanks, I try it. I'm basically looking for an equivalent to Carbon's HITheme API, which allows you to draw theme-compliant control parts yourself, and it looks like cells are the way to achieve this with Cocoa. It's just that it isn't obvious how to get it to work.

Another option than a bitmap context (which is a rather low-level way to go about things) would be to just use an NSImage.

Yep, I saw that it has a lockFocus call as well. Again, for the existing code base it's much easier to be able to work with low-level CG calls instead of Cocoa objects. Cocoa is a great way to do things, but it's so different from other APIs (such as Carbon or Win32) that it makes porting very hard...

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


References: 
 >NSSliderCell, lockFocus question (From: Frederik Slijkerman <email@hidden>)
 >Re: NSSliderCell, lockFocus question (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: Autosaving the selection in an NSTableView
  • Next by Date: Re: NSSliderCell, lockFocus question
  • Previous by thread: Re: NSSliderCell, lockFocus question
  • Next by thread: Re: NSSliderCell, lockFocus question
  • Index(es):
    • Date
    • Thread