Added MYWindowUtils, being used by Murky.
authorJens Alfke <jens@mooseyard.com>
Tue May 05 11:09:06 2009 -0700 (2009-05-05)
changeset 28206903ba35a5
parent 27 256370e8935a
child 29 8874aff14cc9
Added MYWindowUtils, being used by Murky.
MYWindowUtils.h
MYWindowUtils.m
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/MYWindowUtils.h	Tue May 05 11:09:06 2009 -0700
     1.3 @@ -0,0 +1,16 @@
     1.4 +//
     1.5 +//  MYWindowUtils.h
     1.6 +//  Murky
     1.7 +//
     1.8 +//  Created by Jens Alfke on 5/5/09.
     1.9 +//  Copyright 2009 Jens Alfke. All rights reserved.
    1.10 +//
    1.11 +
    1.12 +#import <Cocoa/Cocoa.h>
    1.13 +
    1.14 +
    1.15 +@interface NSWindow (MYUtilities)
    1.16 +
    1.17 +- (void) my_setTitleBarIcon: (NSImage*)icon;
    1.18 +
    1.19 +@end
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/MYWindowUtils.m	Tue May 05 11:09:06 2009 -0700
     2.3 @@ -0,0 +1,27 @@
     2.4 +//
     2.5 +//  MYWindowUtils.m
     2.6 +//  Murky
     2.7 +//
     2.8 +//  Created by Jens Alfke on 5/5/09.
     2.9 +//  Copyright 2009 Jens Alfke. All rights reserved.
    2.10 +//
    2.11 +
    2.12 +#import "MYWindowUtils.h"
    2.13 +
    2.14 +
    2.15 +@implementation NSWindow (MYUtilities)
    2.16 +
    2.17 +
    2.18 +- (void) my_setTitleBarIcon: (NSImage*)icon
    2.19 +{
    2.20 +    NSURL *url = nil;
    2.21 +    if( icon ) {
    2.22 +        icon = [[icon copy] autorelease];
    2.23 +        [icon setSize: NSMakeSize(16,16)];
    2.24 +        url = [NSURL fileURLWithPath: @"/System/XXX"];
    2.25 +    }
    2.26 +    [self setRepresentedURL: url];
    2.27 +    [[self standardWindowButton:NSWindowDocumentIconButton] setImage: icon];
    2.28 +}
    2.29 +
    2.30 +@end