• 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: Obtaining the NSGraphicsContext for custom NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obtaining the NSGraphicsContext for custom NSView


  • Subject: Re: Obtaining the NSGraphicsContext for custom NSView
  • From: Serge Meynard <email@hidden>
  • Date: Tue, 15 Mar 2005 17:48:22 -0500

It looks like you're trying to implement an NSSlider subclass, in which case you're doing more work than you need to. Did you know that you can override -drawKnob: in NSSliderCell?

Oh really? I just got stuff working on my end (I'm not going through the drawRect method). How far can I go in customizing how the slider looks

If you make an NSSliderCell subclass, you can draw whatever you like in -drawInside:inView:.

Also, if your knob or bar aren't the standard size (which varies on controlSize) you'll probably want to override NSSlider's -sizeToFit to keep it from adjusting itself.

When I was looking at NSSlider last week, it struck me that you apparently can't override the tick mark drawing code. I had thought of doing so to selectively change the color of some of the tick marks. Did I miss something?


I don't see why you couldn't grab the rectOfTickMarkAtIndex: and draw in a different color after super draws. :/

I suppose you could override drawInteriorWithFrame:inView:, call super, then redraw each tick mark by getting the rect, erasing it, and drawing your own. Not as elegant as having an override for it however.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Obtaining the NSGraphicsContext for custom NSView (From: Damien Sorresso <email@hidden>)
 >Re: Obtaining the NSGraphicsContext for custom NSView (From: Chris Eplett <email@hidden>)
 >Re: Obtaining the NSGraphicsContext for custom NSView (From: Damien Sorresso <email@hidden>)
 >Re: Obtaining the NSGraphicsContext for custom NSView (From: "John C. Randolph" <email@hidden>)
 >Re: Obtaining the NSGraphicsContext for custom NSView (From: Damien Sorresso <email@hidden>)
 >Re: Obtaining the NSGraphicsContext for custom NSView (From: "John C. Randolph" <email@hidden>)
 >Re: Obtaining the NSGraphicsContext for custom NSView (From: Ryan Stevens <email@hidden>)
 >Re: Obtaining the NSGraphicsContext for custom NSView (From: Serge Meynard <email@hidden>)
 >Re: Obtaining the NSGraphicsContext for custom NSView (From: Ryan Stevens <email@hidden>)

  • Prev by Date: Re: multidimensional arrays
  • Next by Date: Undo manager
  • Previous by thread: Re: Obtaining the NSGraphicsContext for custom NSView
  • Next by thread: Re: Obtaining the NSGraphicsContext for custom NSView
  • Index(es):
    • Date
    • Thread