1 | //
|
---|
2 | // NSTableView-NJRExtensions.m
|
---|
3 | // Pester
|
---|
4 | //
|
---|
5 | // Created by Nicholas Riley on Sun Oct 27 2002.
|
---|
6 | // Copyright (c) 2002 Nicholas Riley. All rights reserved.
|
---|
7 | //
|
---|
8 |
|
---|
9 | #import "NSTableView-NJRExtensions.h"
|
---|
10 |
|
---|
11 |
|
---|
12 | @interface NSTableView (PumaPrivate)
|
---|
13 | // Declarations of 10.1 private methods, just to make the compiler happy.
|
---|
14 | + (id) _defaultTableHeaderReverseSortImage;
|
---|
15 | + (id) _defaultTableHeaderSortImage;
|
---|
16 | @end
|
---|
17 |
|
---|
18 | @implementation NSTableView (NJRExtensions)
|
---|
19 |
|
---|
20 | + (NSImage *)ascendingSortIndicator;
|
---|
21 | {
|
---|
22 | NSImage *result = [NSImage imageNamed: @"NSAscendingSortIndicator"];
|
---|
23 | if (result == nil && [[NSTableView class] respondsToSelector: @selector(_defaultTableHeaderSortImage)])
|
---|
24 | result = [NSTableView _defaultTableHeaderSortImage];
|
---|
25 | return result;
|
---|
26 | }
|
---|
27 |
|
---|
28 | + (NSImage *)descendingSortIndicator;
|
---|
29 | {
|
---|
30 | NSImage *result = [NSImage imageNamed:@"NSDescendingSortIndicator"];
|
---|
31 | if (result == nil && [[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderReverseSortImage)])
|
---|
32 | result = [NSTableView _defaultTableHeaderReverseSortImage];
|
---|
33 | return result;
|
---|
34 | }
|
---|
35 |
|
---|
36 | - (NSArray *)selectedRowIndices;
|
---|
37 | {
|
---|
38 | NSEnumerator *theEnum = [self selectedRowEnumerator];
|
---|
39 | NSNumber *rowNumber;
|
---|
40 | NSMutableArray *rowNumberArray = [NSMutableArray arrayWithCapacity: [self numberOfSelectedRows]];
|
---|
41 |
|
---|
42 | while (nil != (rowNumber = [theEnum nextObject]) )
|
---|
43 | [rowNumberArray addObject: rowNumber];
|
---|
44 |
|
---|
45 | return rowNumberArray;
|
---|
46 | }
|
---|
47 |
|
---|
48 | - (float)cellHeight;
|
---|
49 | {
|
---|
50 | return [self rowHeight] + [self intercellSpacing].height;
|
---|
51 | }
|
---|
52 |
|
---|
53 | // causes NSTableView to get keyboard focus (with thanks to Pierre-Olivier Latour)
|
---|
54 | - (BOOL)needsPanelToBecomeKey
|
---|
55 | {
|
---|
56 | return YES;
|
---|
57 | }
|
---|
58 |
|
---|
59 | @end
|
---|