Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

NSImageCell for Priority

  • Loading branch information...
commit 1c5e09a13b4db590e4df15a3a381b8ff4fd71a70 1 parent 5e6a35f
Greg Allen authored
View
91 English.lproj/MainMenu.xib
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1060</int>
+ <int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10C540</string>
<string key="IBDocument.InterfaceBuilderVersion">740</string>
<string key="IBDocument.AppKitVersion">1038.25</string>
@@ -21,8 +21,8 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="533"/>
<integer value="81"/>
+ <integer value="533"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1061,8 +1061,8 @@
<bool key="NSIsEditable">YES</bool>
<reference key="NSTableView" ref="1010431952"/>
</object>
- <object class="NSTableColumn" id="385279558">
- <double key="NSWidth">188</double>
+ <object class="NSTableColumn" id="1052006821">
+ <double key="NSWidth">10</double>
<double key="NSMinWidth">10</double>
<double key="NSMaxWidth">3.4028234663852886e+38</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
@@ -1070,7 +1070,7 @@
<int key="NSCellFlags2">2048</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="26"/>
- <object class="NSColor" key="NSBackgroundColor">
+ <object class="NSColor" key="NSBackgroundColor" id="1051492928">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">headerColor</string>
@@ -1081,6 +1081,32 @@
</object>
<reference key="NSTextColor" ref="20844329"/>
</object>
+ <object class="NSImageCell" key="NSDataCell" id="144642319">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">33685504</int>
+ <reference key="NSSupport" ref="26"/>
+ <int key="NSAlign">0</int>
+ <int key="NSScale">0</int>
+ <int key="NSStyle">0</int>
+ <bool key="NSAnimates">NO</bool>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="1010431952"/>
+ </object>
+ <object class="NSTableColumn" id="385279558">
+ <double key="NSWidth">166</double>
+ <double key="NSMinWidth">10</double>
+ <double key="NSMaxWidth">3.4028234663852886e+38</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628096</int>
+ <int key="NSCellFlags2">2048</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSBackgroundColor" ref="1051492928"/>
+ <reference key="NSTextColor" ref="20844329"/>
+ </object>
<object class="NSTextFieldCell" key="NSDataCell" id="623777842">
<int key="NSCellFlags">67239488</int>
<int key="NSCellFlags2">272761856</int>
@@ -2317,6 +2343,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="625209997"/>
<reference ref="385279558"/>
+ <reference ref="1052006821"/>
</object>
<reference key="parent" ref="602624907"/>
</object>
@@ -2364,11 +2391,6 @@
<reference key="parent" ref="720053764"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">629</int>
- <reference key="object" ref="623777842"/>
- <reference key="parent" ref="385279558"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">24</int>
<reference key="object" ref="835318025"/>
<object class="NSMutableArray" key="children">
@@ -2527,6 +2549,25 @@
<reference key="object" ref="510805079"/>
<reference key="parent" ref="720053764"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">680</int>
+ <reference key="object" ref="1052006821"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="144642319"/>
+ </object>
+ <reference key="parent" ref="1010431952"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">684</int>
+ <reference key="object" ref="144642319"/>
+ <reference key="parent" ref="1052006821"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">685</int>
+ <reference key="object" ref="623777842"/>
+ <reference key="parent" ref="385279558"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2700,8 +2741,6 @@
<string>608.IBPluginDependency</string>
<string>614.IBPluginDependency</string>
<string>621.IBPluginDependency</string>
- <string>629.CustomClassName</string>
- <string>629.IBPluginDependency</string>
<string>634.IBPluginDependency</string>
<string>636.IBEditorWindowLastContentRect</string>
<string>636.IBPluginDependency</string>
@@ -2724,6 +2763,9 @@
<string>665.IBPluginDependency</string>
<string>676.IBPluginDependency</string>
<string>678.IBPluginDependency</string>
+ <string>684.IBPluginDependency</string>
+ <string>685.CustomClassName</string>
+ <string>685.IBPluginDependency</string>
<string>73.IBPluginDependency</string>
<string>73.ImportedFromIB2</string>
<string>79.IBPluginDependency</string>
@@ -2836,7 +2878,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{525, 802}, {197, 73}}</string>
- <string>{{369, 1069}, {414, 20}}</string>
+ <string>{{408, 1069}, {414, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{74, 862}</string>
@@ -2879,9 +2921,9 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{430, 368}, {253, 268}}</string>
+ <string>{{961, 210}, {253, 268}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{430, 368}, {253, 268}}</string>
+ <string>{{961, 210}, {253, 268}}</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.brandonwalkin.BWToolkit</string>
@@ -2908,8 +2950,6 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>TransparentTableViewCell</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{631, 653}, {145, 83}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2939,10 +2979,13 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>TransparentTableViewCell</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{465, 916}, {210, 153}}</string>
+ <string>{{504, 916}, {210, 153}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{145, 474}, {199, 203}}</string>
@@ -2970,7 +3013,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">679</int>
+ <int key="maxID">685</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -3295,6 +3338,14 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSImageCell</string>
+ <string key="superclassName">NSCell</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">AppKit.framework/Headers/NSImageCell.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSMatrix</string>
<string key="superclassName">NSControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -3758,7 +3809,7 @@
<int key="IBDocument.localizationMode">0</int>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <integer value="1060" key="NS.object.0"/>
+ <integer value="1050" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
View
3  MilkMaidAppDelegate.h
@@ -28,6 +28,9 @@
NSString *timeline;
IBOutlet BWTransparentPopUpButton *listPopUp;
IBOutlet BWTransparentTableView *taskTable;
+ NSImage *priority1Image;
+ NSImage *priority2Image;
+ NSImage *priority3Image;
IBOutlet YRKSpinningProgressIndicator *progress;
View
67 MilkMaidAppDelegate.m
@@ -18,6 +18,10 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSString *apiKey = @"1734ba9431007c2242b6865a69940aa5";
NSString *secret = @"72d1c12ffb26e759";
+ priority1Image = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"priority1" ofType:@"png"]];
+ priority2Image = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"priority2" ofType:@"png"]];
+ priority3Image = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"priority3" ofType:@"png"]];
+
[progress setForeColor:[NSColor whiteColor]];
[progress startAnimation:nil];
@@ -183,25 +187,54 @@ -(void)loadTaskData {
-(NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
return [tasks count];
}
+
++ (NSColor *) colorFromHexRGB:(NSString *) inColorString
+{
+ NSColor *result = nil;
+ unsigned int colorCode = 0;
+ unsigned char redByte, greenByte, blueByte;
+
+ if (nil != inColorString)
+ {
+ NSScanner *scanner = [NSScanner scannerWithString:inColorString];
+ (void) [scanner scanHexInt:&colorCode]; // ignore error
+ }
+ redByte = (unsigned char) (colorCode >> 16);
+ greenByte = (unsigned char) (colorCode >> 8);
+ blueByte = (unsigned char) (colorCode); // masks off high bits
+ result = [NSColor
+ colorWithCalibratedRed: (float)redByte / 0xff
+ green: (float)greenByte/ 0xff
+ blue: (float)blueByte / 0xff
+ alpha:1.0];
+ return result;
+}
-(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
//check type of cell
+
id cell = [tableColumn dataCellForRow:row];
+ //NSLog(@"%@", cell);
if ([cell isMemberOfClass:[BWTransparentCheckboxCell class]]) {
return [NSNumber numberWithInteger:NSOffState];
- } else {//if ([cell isMemberOfClass:[BWTransparentTableViewCell class]]) {
+ } else if ([cell isMemberOfClass:[NSImageCell class]]) {
NSDictionary *task = [tasks objectAtIndex:row];
-
NSString *pri = [task objectForKey:@"priority"];
if ([pri isEqualToString:@"1"]) {
- [cell setTextColor:[[self class] colorFromHexRGB:@"EA5200"]];
+ return priority1Image;
} else if ([pri isEqualToString:@"2"]) {
- [cell setTextColor:[[self class] colorFromHexRGB:@"0060BF"]];
+ return priority2Image;
} else if ([pri isEqualToString:@"3"]) {
- [cell setTextColor:[[self class] colorFromHexRGB:@"359AFF"]];
+ return priority3Image;
} else {
- [cell setTextColor:[NSColor whiteColor]];
+ return nil;
}
+ } else {//if ([cell isMemberOfClass:[BWTransparentTableViewCell class]]) {
+ NSDictionary *task = [tasks objectAtIndex:row];
+
+
+ [cell setTextColor:[NSColor whiteColor]];
+
id due = [task objectForKey:@"due"];
if ([due isKindOfClass:[NSDate class]] && ([due isPastDate] || [[NSDate date] isEqualToDate:due])) {
@@ -215,27 +248,7 @@ -(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn
}
-+ (NSColor *) colorFromHexRGB:(NSString *) inColorString
-{
- NSColor *result = nil;
- unsigned int colorCode = 0;
- unsigned char redByte, greenByte, blueByte;
-
- if (nil != inColorString)
- {
- NSScanner *scanner = [NSScanner scannerWithString:inColorString];
- (void) [scanner scanHexInt:&colorCode]; // ignore error
- }
- redByte = (unsigned char) (colorCode >> 16);
- greenByte = (unsigned char) (colorCode >> 8);
- blueByte = (unsigned char) (colorCode); // masks off high bits
- result = [NSColor
- colorWithCalibratedRed: (float)redByte / 0xff
- green: (float)greenByte/ 0xff
- blue: (float)blueByte / 0xff
- alpha:1.0];
- return result;
-}
+
-(void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
NSDictionary *task = [tasks objectAtIndex:row];
View
BIN  priority1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  priority2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  priority3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.