CocoaDev

Edit AllPages

This is the depository for three classes which together form the base code for my implementation of the search filter bar seen in itunes, safari, finder, and mail.

The hope is that if you want to do it your own way, here’s all the code. But I plan on creating an IB palette for the whole project once it’s polished off. So just check back in.

Note that the code references 17 outside images, 15 of which can be found in Mail.app’s bundle and are the basis for the button background in that style. The other two are tiling strips for the two background styles (itunes and mail styles), and I guess if you want them you should post here telling me where I can drop them online and have them accessible. No way I’m putting them in my .mac account.

Current status: correct display of all 3 styles with corresponding buttons; does NOT connect to a delegate, therefore there is only one button in the bar (but it’s a purdy button!)

Heads up: the three classes are: FilterBar SDFilterBarButton SDFilterBarButtonCell


/* FilterBar */

#import <Cocoa/Cocoa.h> #import “SDFilterBarButton.h” #import “SDFilterBarButtonCell.h”

@interface FilterBar : NSView { NSImage *backgroundImage; NSMutableArray *buttons; }

@end

#import “FilterBar.h”

@implementation FilterBar

#pragma mark - #pragma mark Setup

#pragma mark - #pragma mark Display

#pragma mark - #pragma mark Cell creation

}

#pragma mark - #pragma mark Expiremental

#pragma mark - #pragma mark Tracking rects

@end

#import <Cocoa/Cocoa.h> #import “SDFilterBarButtonCell.h”

@interface SDFilterBarButton : NSButton {

}

@end

#import “SDFilterBarButton.h”

@implementation SDFilterBarButton

#pragma mark - #pragma mark Setup

#pragma mark - #pragma mark Mouse tracking

#pragma mark - #pragma mark Action

@end

#import <Cocoa/Cocoa.h>

@interface [[SDFilterBarButtonCell : NSButtonCell { BOOL selected; BOOL mouseInView; }

@end

#import “SDFilterBarButtonCell.h”

@implementation SDFilterBarButtonCell

#pragma mark - #pragma mark Setup

#pragma mark - #pragma mark Selection logic

#pragma mark - #pragma mark Drawing

@end