Changeset 720


Ignore:
Timestamp:
Aug 5, 2006, 1:22:30 PM (15 years ago)
Author:
livings124
Message:

Make the filter buttons themselves control when they are active/inactive.

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/BarButton.h

    r686 r720  
    3838- (void) resetBounds: (NSNotification *) notification;
    3939
    40 - (void) setForActive;
    41 - (void) setForInactive;
     40- (void) setForActive: (NSNotification *) notification;
     41- (void) setForInactive: (NSNotification *) notification;
    4242
    4343@end
  • trunk/macosx/BarButton.m

    r710 r720  
    4646        [self setAlternateImage: fButtonPressed];
    4747       
    48         [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(resetBounds:)
     48        NSNotificationCenter * nc = [NSNotificationCenter defaultCenter];
     49       
     50        [nc addObserver: self selector: @selector(setForActive:)
     51                    name: NSWindowDidBecomeKeyNotification object: nil];
     52       
     53        [nc addObserver: self selector: @selector(setForInactive:)
     54                    name: NSWindowDidResignKeyNotification object: nil];
     55       
     56        [nc addObserver: self selector: @selector(resetBounds:)
    4957                    name: NSViewBoundsDidChangeNotification object: nil];
    5058        }
     
    243251}
    244252
    245 - (void) setForActive
    246 {
     253- (void) setForActive: (NSNotification *) notification
     254{
     255    NSWindow * window;
     256    if (!(window = [notification object]) || window != [self window])
     257        return;
     258
    247259    if ([self image] == fButtonSelectedDim)
    248260        [self setImage: fButtonSelected];
     
    254266}
    255267
    256 - (void) setForInactive
    257 {
     268- (void) setForInactive: (NSNotification *) notification
     269{
     270    NSWindow * window;
     271    if (!(window = [notification object]) || window != [self window])
     272        return;
     273
    258274    [self setImage: [self image] == fButtonSelected ? fButtonSelectedDim : fButtonNormalDim];
    259275   
  • trunk/macosx/Controller.m

    r717 r720  
    22082208        [self resetDockBadge: nil];
    22092209    }
    2210    
    2211     //set filter images as active
    2212     [fNoFilterButton setForActive];
    2213     [fSeedFilterButton setForActive];
    2214     [fDownloadFilterButton setForActive];
    2215     [fPauseFilterButton setForActive];
    2216 }
    2217 
    2218 - (void) windowDidResignKey: (NSNotification *) notification
    2219 {
    2220     //set filter images as inactive
    2221     [fNoFilterButton setForInactive];
    2222     [fSeedFilterButton setForInactive];
    2223     [fDownloadFilterButton setForInactive];
    2224     [fPauseFilterButton setForInactive];
    22252210}
    22262211
  • trunk/macosx/PrefsController.m

    r719 r720  
    7878        fHandle = handle;
    7979       
    80         [[self window] update]; //makesure nib is loaded right away
     80        [[self window] update]; //make sure nib is loaded right away
    8181    }
    8282    return self;
Note: See TracChangeset for help on using the changeset viewer.