source: trunk/Cocoa/Pester/Source/NSTableView-NJRExtensions.m@ 618

Last change on this file since 618 was 51, checked in by Nicholas Riley, 21 years ago

Alarms.nib: Removed horizontal scroll bar. Turned on grid. Set delegate to NJRTableDelegate instead of PSAlarmSetController.

NJRTableDelegate: In general, made functional (was previously unused). Fixed MyCompanyName. Changed ORDER_BY_CONTEXT to use key-value coding instead of assuming data consists of a dictionary of dictionaries. Added sorting support (reorderedData, replaces oData) with autosave support for sort context. Added _positionTypeSelectDisplay, which adjusts position and justification of type select display control based on the current sort column. Added support for reverse sorting in type select string. Use table data source instead of sorted data so text matches as displayed (this will break with non-text cells...).

NJRTableView: Adapted from iTableView (Jaguar table alternate table background color), TableTester (most everything else) and NJROutlineView (keyDown, moveToBeginning/EndOfDocument). Support for type selection, delete shortcut for row deletion, and iTunes-alike background colors and frame.

NSCharacterSet-NJRExtensions: Moved _typeSelectSet from NJROutlineView as it's now shared with NJRTableView. Still need to factor NJROutlineView as embedded in HostLauncher some day.

PSAlarm: Reorganized, renamed and categorized methods. Added time accessor for the benefit of sorting. Renamed compare: to compareDate: for clarity. Added compareMessage:, though it's currently unused. Renamed cancel to cancelTimer for clarity.

PSAlarmSetController: More fun with initial first responder on window show/hide; still need to work around bug properly (subclass NSComboBox?) and fix it for real. As is, works for OS X 10.1.

PSAlarms: Added alarms accessor, returning alarm array. Fixed memory leak on successful alarm removal (oops). Added removeAlarms:, needed with sorted alarm list.

PSAlarmsController: Set window resize increment. Changes to table delegate methods to use reordered alarm list. Register for NSTableViewSelectionDidChangeNotification now we're no longer the table view delegate. Fixed autoselection in alarmsChanged by using data reordering support in NJRTableView. Implement NJRTableViewDataSource to permit deletion from table view.

Pester.pbproj: Added new files.

Read Me.rtfd: Added TableTester/iTableView acknowledgements. Updated release notes.

File size: 1.3 KB
Line 
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- (float)cellHeight;
37{
38 return [self rowHeight] + [self intercellSpacing].height;
39}
40
41// causes NSTableView to get keyboard focus (with thanks to Pierre-Olivier Latour)
42- (BOOL)needsPanelToBecomeKey
43{
44 return YES;
45}
46
47@end
Note: See TracBrowser for help on using the repository browser.