My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones  
Changes to /AppKit/nib.subproj/NSButtonImageSource.m
e5277a40a7e8 vs. 2470bd80abf4 Compare: vs.  Format:
Revision 2470bd80abf4
Go to: 
Project members, sign in to write a code review
/AppKit/nib.subproj/NSButtonImageSource.m   e5277a40a7e8 /AppKit/nib.subproj/NSButtonImageSource.m   2470bd80abf4
1 /* Copyright (c) 2006 Christopher J. W. Lloyd 1 /* Copyright (c) 2006-2007 Christopher J. W. Lloyd
2 2
3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 4
5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 6
7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
8 8
9 // Original - Christopher Lloyd <cjwl@objc.net> 9 // Original - Christopher Lloyd <cjwl@objc.net>
10 #import "NSButtonImageSource.h" 10 #import "NSButtonImageSource.h"
11 #import <Foundation/NSString.h> 11 #import <Foundation/NSString.h>
12 #import <AppKit/NSNibKeyedUnarchiver.h> 12 #import <AppKit/NSNibKeyedUnarchiver.h>
13 #import <AppKit/NSImage.h> 13 #import <AppKit/NSImage.h>
14 14
15 @implementation NSButtonImageSource 15 @implementation NSButtonImageSource
16 16
17 -initWithCoder:(NSCoder *)coder { 17 -initWithCoder:(NSCoder *)coder {
18 if([coder isKindOfClass:[NSNibKeyedUnarchiver class]]){ 18 if([coder isKindOfClass:[NSNibKeyedUnarchiver class]]){
19 NSNibKeyedUnarchiver *keyed=(NSNibKeyedUnarchiver *)coder; 19 NSNibKeyedUnarchiver *keyed=(NSNibKeyedUnarchiver *)coder;
20 20
21 _imageName=[[keyed decodeObjectForKey:@"NSImageName"] retain]; 21 _imageName=[[keyed decodeObjectForKey:@"NSImageName"] retain];
22 } 22 }
23 return self; 23 return self;
24 } 24 }
25 25
26 -(void)dealloc { 26 -(void)dealloc {
27 [_imageName release]; 27 [_imageName release];
28 [super dealloc]; 28 [super dealloc];
29 } 29 }
30 30
31 // represents the many alternate images for state, we just return the highlighted image for now 31 // represents the many alternate images for state, we just return the highlighted image for now
32 -awakeAfterUsingCoder:(NSCoder *)coder { 32 -awakeAfterUsingCoder:(NSCoder *)coder {
33 NSString *name=[@"NSHighlighted" stringByAppendingString:[_imageName substringFromIndex:2]]; 33 NSString *name=[@"NSHighlighted" stringByAppendingString:[_imageName substringFromIndex:2]];
34 34
35 return [NSImage imageNamed:name]; 35 return [NSImage imageNamed:name];
36 } 36 }
37 37
38 @end 38 @end
Powered by Google Project Hosting