Changeset 4988

Show
Ignore:
Timestamp:
10/21/07 23:27:27 (9 months ago)
Author:
morris
Message:

Add orderFront:animate: and orderOut:animate:

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredAdditions/trunk/NSWindow-WIAdditions.h

    r4954 r4988  
    4040- (void)snapToScreenEdgeAndDisplay:(BOOL)display animate:(BOOL)animate; 
    4141 
     42- (void)orderFront:(id)sender animate:(BOOL)animate; 
     43- (void)orderOut:(id)sender animate:(BOOL)animate; 
     44 
    4245@end 
  • WiredAdditions/trunk/NSWindow-WIAdditions.m

    r4962 r4988  
    160160} 
    161161 
     162 
     163 
     164#pragma mark - 
     165 
     166- (void)_animateOrderFront:(id)sender { 
     167        float           alpha; 
     168         
     169        alpha = [self alphaValue] + 0.1; 
     170         
     171        [self setAlphaValue:alpha]; 
     172         
     173        if(alpha < 1.0) 
     174                [self performSelector:@selector(_animateOrderFront:) withObject:sender afterDelay:0.03]; 
     175} 
     176 
     177 
     178 
     179- (void)_animateOrderOut:(id)sender { 
     180        float           alpha; 
     181         
     182        alpha = [self alphaValue] - 0.05; 
     183         
     184        [self setAlphaValue:alpha]; 
     185         
     186        if(alpha > 0.0) 
     187                [self performSelector:@selector(_animateOrderOut:) withObject:sender afterDelay:0.03]; 
     188        else 
     189                [self orderOut:sender]; 
     190} 
     191 
     192 
     193 
     194- (void)orderFront:(id)sender animate:(BOOL)animate { 
     195        if(!animate) { 
     196                [self orderFront:sender]; 
     197                 
     198                return; 
     199        } 
     200         
     201        [self setAlphaValue:0.0]; 
     202        [self orderFront:sender]; 
     203         
     204        [self performSelector:@selector(_animateOrderFront:) withObject:sender afterDelay:0.03]; 
     205} 
     206 
     207 
     208 
     209- (void)orderOut:(id)sender animate:(BOOL)animate { 
     210        if(!animate) { 
     211                [self orderOut:sender]; 
     212                 
     213                return; 
     214        } 
     215         
     216        [self performSelector:@selector(_animateOrderOut:) withObject:sender afterDelay:0.03]; 
     217} 
     218 
    162219@end