[428] | 1 | //
|
---|
| 2 | // ICeCoffEEMenuOutlineView.m
|
---|
| 3 | // ICeCoffEE
|
---|
| 4 | //
|
---|
| 5 | // Created by Nicholas Riley on 3/2/08.
|
---|
| 6 | // Copyright 2008 Nicholas Riley. All rights reserved.
|
---|
| 7 | //
|
---|
| 8 |
|
---|
| 9 | #import "ICeCoffEEMenuOutlineView.h"
|
---|
| 10 | #import <Carbon/Carbon.h>
|
---|
| 11 |
|
---|
| 12 | @implementation ICeCoffEEMenuOutlineView
|
---|
| 13 |
|
---|
[429] | 14 | // undocumented, Leopard-only, only way I can figure out to bypass inter-cell navigation
|
---|
| 15 | - (BOOL)canFocusCell:(NSCell *)cell atTableColumn:(NSTableColumn *)tableColumn row:(int)row;
|
---|
| 16 | {
|
---|
| 17 | return NO;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
[428] | 20 | - (void)highlightSelectionInClipRect:(NSRect)clipRect;
|
---|
| 21 | {
|
---|
| 22 | NSRange rows = [self rowsInRect: clipRect];
|
---|
| 23 | unsigned maxRow = NSMaxRange(rows);
|
---|
| 24 |
|
---|
| 25 | HIThemeMenuItemDrawInfo drawInfo = {0, kThemeMenuItemHierBackground | kThemeMenuItemPopUpBackground, kThemeMenuSelected};
|
---|
| 26 | if ([[self window] firstResponder] != self || [NSApp keyWindow] != [self window]) {
|
---|
| 27 | NSLog(@"firstResponder %@ key %@ main %@ this %@", [[self window] firstResponder], [NSApp keyWindow], [NSApp mainWindow], [self window]);
|
---|
| 28 | [super highlightSelectionInClipRect: clipRect];
|
---|
| 29 | return;
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | for (unsigned row = rows.location ; row < maxRow ; ++row) {
|
---|
| 33 | if (![self isRowSelected: row])
|
---|
| 34 | continue;
|
---|
| 35 |
|
---|
| 36 | NSRect rowRect = [self rectOfRow: row];
|
---|
| 37 | rowRect.size.height += 2;
|
---|
| 38 | if (NSIntersectsRect(rowRect, clipRect)) {
|
---|
| 39 | OSStatus err = HIThemeDrawMenuItem((HIRect *)&clipRect,
|
---|
| 40 | (HIRect *)&rowRect,
|
---|
| 41 | &drawInfo,
|
---|
| 42 | (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort],
|
---|
| 43 | kHIThemeOrientationInverted,
|
---|
| 44 | (HIRect *)&rowRect);
|
---|
| 45 | if (err != noErr) {
|
---|
| 46 | [super highlightSelectionInClipRect: clipRect];
|
---|
| 47 | return;
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | @end
|
---|