Hello.

I have a Custom Button Cell, and its corresponding CustomButton, When I use 
these component in any other cell they work perfect, when I click the button, 
my NSButonCell's overrode method
- (void)highlight:(BOOL)flag withFrame:(NSRect)cellFrame inView:(NSView 
*)controlView{
makes the drawing of the button when the user clicks it, so it change to the 
proper theme color.

Now I set up a view with a layer from a NSTextField label, and added a bloom 
animation like these. taken form apple docs, and then I set the view to [self 
setWantLayer:YES];

                CIFilter * filter = [CIFilter filterWithName:@"CIBloom"];
                
                [filter setDefaults];
                [filter setValue:[NSNumber numberWithFloat:3.0f] 
forKey:@"inputRadius"];
                [filter setName:@"pulseFilter"];
                [modTitleLayer setFilters:[NSArray 
arrayWithObjects:filter,nil]];
                
                // The selectionLayer shows a subtle pulse as it
                // is displayed. This section of the code create the pulse 
animation
                // setting the filters.pulsefilter.inputintensity to range from 
0 to 2.
                // This will happen every second, autoreverse, and repeat 
forever
                CABasicAnimation* pulseAnimation = [CABasicAnimation animation];
                pulseAnimation.keyPath = @"filters.pulseFilter.inputIntensity";
                pulseAnimation.fromValue = [NSNumber numberWithFloat: 0.0];
                pulseAnimation.toValue = [NSNumber numberWithFloat: 1.0];
                pulseAnimation.duration = 1.0;
                pulseAnimation.repeatCount = 1e100f;
                pulseAnimation.autoreverses = YES;
                pulseAnimation.timingFunction = [CAMediaTimingFunction 
functionWithName:
                                                                                
 kCAMediaTimingFunctionEaseInEaseOut];
                [modTitleLayer addAnimation:pulseAnimation 
forKey:@"pulseAnimation"];

But my highlight method does no custom drawing, actually its being called, but 
it does nothing.

any ideas what might be happening? maybe something missing in the higlighl 
method?
this is what Im doing there: Using a gloss drawing thanks for Cocoa with love 
and Mat Gallagher

if(flag){
                NSGraphicsContext *graphicsContext = [NSGraphicsContext 
currentContext];
                [graphicsContext saveGraphicsState];
                NSBezierPath * path = [NSBezierPath 
bezierPathWithRoundedRect:NSInsetRect(cellFrame,1.0, 1.0) xRadius:10.0 
yRadius:10.0];
                [path addClip];

                DrawGlossGradient(
                                                  [graphicsContext 
graphicsPort],
                                                  [NSColor 
colorWithCalibratedRed:0.0 green:0.1522 blue:0.4130 alpha:1.0],
                                                  cellFrame);
                //[self setBackgroundColor:[NSColor 
colorWithCalibratedRed:(CGFloat)0.3 green:(CGFloat)0.3 blue:(CGFloat)0.3 
alpha:(CGFloat)0.3]];
                 
                
                                //[_higLightGradient drawInBezierPath:path 
relativeCenterPosition:NSZeroPoint];
                //[_higLightGradient drawInBezierPath:path angle:90.0];
                [graphicsContext restoreGraphicsState];
                if(_fontMask == NSBoldFontMask){
                        //      cellFrame.origin.y += 5.0f;     //This is the 
Bold font mask value
                }
                
                [super drawWithFrame:cellFrame inView:controlView];
                
        }
        else {
                [self setBackgroundColor:nil];
        }

if after setting up the animation I place [self setWantLayer:NO]  the highlight 
method draws the color of the button when pressed.

Thanks in advance


Gustavo Pizano








_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to