diff options
author | Damiano Galassi <[email protected]> | 2015-12-05 10:21:23 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2015-12-05 10:21:23 +0100 |
commit | 5e4109859754c58b27534627dbfd014441f48e91 (patch) | |
tree | ad70beb85ecbf30d8db2f00e41de838a3529eb0e /macosx/HBPresetsViewController.m | |
parent | 0d0b4bccc71886f694e5f0a843488d7c5593b3e0 (diff) |
MacGui: use a view-based outline view in the presets drawer.
Diffstat (limited to 'macosx/HBPresetsViewController.m')
-rw-r--r-- | macosx/HBPresetsViewController.m | 66 |
1 files changed, 29 insertions, 37 deletions
diff --git a/macosx/HBPresetsViewController.m b/macosx/HBPresetsViewController.m index 8933c7e27..532968692 100644 --- a/macosx/HBPresetsViewController.m +++ b/macosx/HBPresetsViewController.m @@ -11,6 +11,35 @@ // drag and drop pasteboard type #define kHandBrakePresetPBoardType @"handBrakePresetPBoardType" +@interface HBPresetCellView : NSTableCellView +@end + +@implementation HBPresetCellView + +- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle +{ + [super setBackgroundStyle:backgroundStyle]; + + // Customize the built-in preset text color + if ([self.objectValue isBuiltIn]) + { + if (backgroundStyle == NSBackgroundStyleDark) + { + self.textField.textColor = [NSColor selectedControlTextColor]; + } + else + { + self.textField.textColor = [NSColor blueColor]; + } + } + else + { + self.textField.textColor = [NSColor controlTextColor]; + } +} + +@end + @interface HBPresetsViewController () <NSOutlineViewDelegate> @property (nonatomic, strong) HBPresetsManager *presets; @@ -253,43 +282,6 @@ [self expandNodes:[self.treeController.arrangedObjects childNodes]]; } -#pragma mark - Added Functionality (optional) - -/* We use this to provide tooltips for the items in the presets outline view */ -- (NSString *)outlineView:(NSOutlineView *)fPresetsOutlineView - toolTipForCell:(NSCell *)cell - rect:(NSRectPointer)rect - tableColumn:(NSTableColumn *)tc - item:(id)item - mouseLocation:(NSPoint)mouseLocation -{ - return [[item representedObject] presetDescription]; -} - -/* Use to customize the font and display characteristics of the title cell */ -- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item -{ - NSColor *fontColor; - - if ([self.outlineView selectedRow] == [self.outlineView rowForItem:item]) - { - fontColor = [NSColor blackColor]; - } - else - { - if ([[item representedObject] isBuiltIn]) - { - fontColor = [NSColor blueColor]; - } - else // User created preset, use a black font - { - fontColor = [NSColor blackColor]; - } - } - - [cell setTextColor:fontColor]; -} - #pragma mark - Expanded node persistence methods - (void)expandNodes:(NSArray *)childNodes |