• 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
NSButtonCell subclass (partially transparent images)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSButtonCell subclass (partially transparent images)


  • Subject: NSButtonCell subclass (partially transparent images)
  • From: Darrin Filer <email@hidden>
  • Date: Fri, 8 Feb 2002 16:24:59 -0500

I'm trying to override
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
in order to make it possible to properly render buttons whose images have transparent areas.

The overridden methods are pasted below. If they are commented out, NSButtonCell's default implementation succeeds in drawing the button's image but without the transparent regions being transparent. With them uncommented, no drawing appears at all.

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
[self drawInteriorWithFrame:cellFrame inView:controlView];
}
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
[controlView lockFocus];
[[self image] compositeToPoint:cellFrame.origin operation:NSCompositeCopy];
[controlView unlockFocus];
[controlView setNeedsDisplay:YES];
}

What gives? Once I can draw into the control view, I'll add in code to draw the appropriate image given button state...

darrin filer
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSButtonCell subclass (partially transparent images)
      • From: "Erik M. Buck" <email@hidden>
References: 
 >Re: Is this a bug in NSTextView or a feature? (From: email@hidden)

  • Prev by Date: Re: How to keep a subview centered - autoresizing
  • Next by Date: New server
  • Previous by thread: Re: Is this a bug in NSTextView or a feature?
  • Next by thread: Re: NSButtonCell subclass (partially transparent images)
  • Index(es):
    • Date
    • Thread