-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added NSTableView_setObjectValue sample project
- Loading branch information
Showing
10 changed files
with
3,901 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// BDObject.h | ||
// NSTableView_setObjectValue | ||
// | ||
// Created by Brian Dunagan on 4/24/09. | ||
// Copyright 2009 bdunagan.com. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface BDObject : NSObject { | ||
BOOL isChecked; | ||
} | ||
|
||
- (id)init; | ||
- (BOOL)isChecked; | ||
- (void)setIsChecked:(BOOL)newValue; | ||
- (NSString *)status; | ||
- (void)setStatus:(id)value; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// BDObject.m | ||
// NSTableView_setObjectValue | ||
// | ||
// Created by Brian Dunagan on 4/24/09. | ||
// Copyright 2009 bdunagan.com. All rights reserved. | ||
// | ||
|
||
#import "BDObject.h" | ||
|
||
@implementation BDObject | ||
|
||
- (id)init { | ||
self = [super init]; | ||
if (self != nil) { | ||
isChecked = NO; | ||
} | ||
return self; | ||
} | ||
|
||
- (BOOL)isChecked { | ||
return isChecked; | ||
} | ||
|
||
- (void)setIsChecked:(BOOL)newValue { | ||
isChecked = newValue; | ||
|
||
// Update dependent property. | ||
[self setStatus:nil]; | ||
} | ||
|
||
- (NSString *)status { | ||
return isChecked ? @"Checked" : @"Unchecked"; | ||
} | ||
|
||
- (void)setStatus:(id)value {} | ||
|
||
@end |
Binary file not shown.
3,453 changes: 3,453 additions & 0 deletions
3,453
NSTableView_setObjectValue/English.lproj/MainMenu.xib
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>English</string> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleIconFile</key> | ||
<string></string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.yourcompany.${PRODUCT_NAME:identifier}</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>NSMainNibFile</key> | ||
<string>MainMenu</string> | ||
<key>NSPrincipalClass</key> | ||
<string>NSApplication</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// MainController.h | ||
// NSTableView_setObjectValue | ||
// | ||
// Created by Brian Dunagan on 4/24/09. | ||
// Copyright 2009 bdunagan.com. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface MainController : NSObject { | ||
IBOutlet NSTableView *list; | ||
IBOutlet NSArrayController *objects; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// MainController.m | ||
// NSTableView_setObjectValue | ||
// | ||
// Created by Brian Dunagan on 4/24/09. | ||
// Copyright 2009 bdunagan.com. All rights reserved. | ||
// | ||
|
||
#import "MainController.h" | ||
#import "BDObject.h" | ||
|
||
@implementation MainController | ||
|
||
- (void)awakeFromNib { | ||
BDObject *object; | ||
|
||
object = [[BDObject alloc] init]; | ||
[objects addObject:object]; | ||
[object release]; | ||
|
||
object = [[BDObject alloc] init]; | ||
[objects addObject:object]; | ||
[object release]; | ||
} | ||
|
||
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { | ||
if (aTableView == list) { | ||
// Update dependent instances. | ||
BOOL newValue = [[[objects arrangedObjects] objectAtIndex:rowIndex] isChecked]; | ||
for (BDObject *object in [objects arrangedObjects]) { | ||
[object setIsChecked:newValue]; | ||
} | ||
} | ||
} | ||
|
||
@end |
Oops, something went wrong.