diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index f92a27412..e55592577 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -33,7 +33,8 @@ var CPMainCibFile = @"CPMainCibFile", - CPMainCibFileHumanFriendly = @"Main cib file base name"; + CPMainCibFileHumanFriendly = @"Main cib file base name", + CPEventModifierFlags = 0; CPApp = nil; @@ -575,6 +576,7 @@ CPRunContinuesResponse = -1002; - (void)sendEvent:(CPEvent)anEvent { _currentEvent = anEvent; + CPEventModifierFlags = [anEvent modifierFlags]; #if PLATFORM(DOM) var willPropagate = [[[anEvent window] platformWindow] _willPropagateCurrentDOMEvent]; @@ -1379,3 +1381,16 @@ var _CPAppBootstrapperActions = nil; } @end + + +@implementation CPEvent (CPApplicationModifierFlags) + +/*! + Returns the currently pressed modifier flags. +*/ ++ (unsigned)modifierFlags +{ + return CPEventModifierFlags; +} + +@end diff --git a/AppKit/CPEvent.j b/AppKit/CPEvent.j index a5fe949bd..543dcaadd 100644 --- a/AppKit/CPEvent.j +++ b/AppKit/CPEvent.j @@ -204,6 +204,8 @@ var _CPEventPeriodicEventPeriod = 0, BOOL _isARepeat; unsigned _keyCode; DOMEvent _DOMEvent; + int _data1; + int _data2; float _deltaX; float _deltaY; @@ -517,6 +519,16 @@ var _CPEventPeriodicEventPeriod = 0, return _DOMEvent; } +- (int)data1 +{ + return _data1; +} + +- (int)data2 +{ + return _data2; +} + // Getting Scroll Wheel Event Information /*! Returns the change in the x-axis for a mouse event. @@ -630,6 +642,29 @@ var _CPEventPeriodicEventPeriod = 0, _CPEventPeriodicEventTimer = nil; } +- (CPString)description +{ + switch (_type) + { + case CPKeyDown: + case CPKeyUp: + case CPFlagsChanged: + return [CPString stringWithFormat:@"CPEvent: type=%d loc=%@ time=%.1f flags=0x%X win=%@ winNum=%d ctxt=%@ chars=\"%@\" unmodchars=\"%@\" repeat=%d keyCode=%d", _type, CPStringFromPoint(_location), _timestamp, _modifierFlags, _window, _windowNumber, _context, _characters, _charactersIgnoringModifiers, _isARepeat, _keyCode]; + case CPLeftMouseDown: + case CPLeftMouseUp: + case CPRightMouseDown: + case CPRightMouseUp: + case CPMouseMoved: + case CPLeftMouseDragged: + case CPRightMouseDragged: + case CPMouseEntered: + case CPMouseExited: + return [CPString stringWithFormat:@"CPEvent: type=%d loc=%@ time=%.1f flags=0x%X win=%@ winNum=%d ctxt=%@ evNum=%d click=%d buttonNumber=%d pressure=%f", _type, CPStringFromPoint(_location), _timestamp, _modifierFlags, _window, _windowNumber, _context, _eventNumber, _clickCount, [self buttonNumber], _pressure]; + default: + return [CPString stringWithFormat:@"CPEvent: type=%d loc=%@ time=%.1f flags=0x%X win=%@ winNum=%d ctxt=%@ subtype=%d data1=%d data2=%d", _type, CPStringFromPoint(_location), _timestamp, _modifierFlags, _window, _windowNumber, _context, _subtype, _data1, _data2]; + } +} + @end function _CPEventFirePeriodEvent() diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 61045d64e..8d8361921 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -4037,8 +4037,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad */ - (BOOL)startTrackingAt:(CGPoint)aPoint { - if (![[self window] makeFirstResponder:self]) - return NO; + // Try to become the first responder, but if we can't, that's okay. + [[self window] makeFirstResponder:self]; var row = [self rowAtPoint:aPoint]; @@ -4189,9 +4189,6 @@ Your delegate can implement this method to avoid subclassing the tableview to ad */ - (void)stopTracking:(CGPoint)lastPoint at:(CGPoint)aPoint mouseIsUp:(BOOL)mouseIsUp { - if ([[self window] firstResponder] !== self) - return; - _isSelectingSession = NO; var CLICK_TIME_DELTA = 1000, diff --git a/AppKit/CPTokenField.j b/AppKit/CPTokenField.j index 7791be27a..8f45054e1 100755 --- a/AppKit/CPTokenField.j +++ b/AppKit/CPTokenField.j @@ -1008,8 +1008,9 @@ var CPScrollDestinationNone = 0, r.origin.y = offset.y; // Make sure the frame fits. - if (_CGRectGetHeight([contentView bounds]) < offset.y + height) - [contentView setFrame:_CGRectMake(0, 0, _CGRectGetWidth([_tokenScrollView bounds]), offset.y + height)]; + var scrollHeight = offset.y + tokenHeight + CEIL(spaceBetweenTokens.height / 2.0); + if (_CGRectGetHeight([contentView bounds]) < scrollHeight) + [contentView setFrameSize:_CGSizeMake(_CGRectGetWidth([_tokenScrollView bounds]), scrollHeight)]; offset.x += width + spaceBetweenTokens.width; @@ -1033,6 +1034,7 @@ var CPScrollDestinationNone = 0, } _inputFrame = fitAndFrame(textWidth, tokenHeight); + _inputFrame.size.height = lineHeight; element.style.left = (_inputFrame.origin.x + editorInset.left) + "px"; @@ -1042,7 +1044,7 @@ var CPScrollDestinationNone = 0, // When editing, always scroll to the cursor. if (_selectedRange.length == 0) - [[_tokenScrollView documentView] scrollRectToVisible:_inputFrame]; + [[_tokenScrollView documentView] scrollPoint:_CGPointMake(0, _inputFrame.origin.y)]; }; for (var i = 0, count = [tokens count]; i < count; i++) @@ -1074,13 +1076,21 @@ var CPScrollDestinationNone = 0, if (isEditing && _selectedRange.length) { _inputFrame = nil; - [self _inputElement].style.left = "-10000px"; - [self _inputElement].focus(); + var inputElement = [self _inputElement]; + inputElement.style.display = "none"; + } + else if (isEditing) + { + var inputElement = [self _inputElement]; + inputElement.style.display = "block"; + if (document.activeElement !== inputElement) + inputElement.focus(); } - // Trim off any excess height downwards. - if (_CGRectGetHeight([contentView bounds]) > offset.y + tokenHeight) - [contentView setFrame:_CGRectMake(0, 0, _CGRectGetWidth([_tokenScrollView bounds]), offset.y + tokenHeight)]; + // Trim off any excess height downwards (in case we shrank). + var scrollHeight = offset.y + tokenHeight + CEIL(spaceBetweenTokens.height / 2.0); + if (_CGRectGetHeight([contentView bounds]) > scrollHeight) + [contentView setFrameSize:_CGSizeMake(_CGRectGetWidth([_tokenScrollView bounds]), scrollHeight)]; if (_shouldScrollTo !== CPScrollDestinationNone) { @@ -1105,7 +1115,7 @@ var CPScrollDestinationNone = 0, if (!aToken) return; - return [[_tokenScrollView documentView] scrollRectToVisible:[aToken frame]]; + return [[_tokenScrollView documentView] scrollPoint:_CGPointMake(0, [aToken frameOrigin].y)]; } @end diff --git a/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j b/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j index 24faf9ba8..05959e4b5 100644 --- a/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j +++ b/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j @@ -38,7 +38,7 @@ var _CPToolbarViewBackgroundColor = nil; _CPToolbarViewBackgroundColor = CPColorWithImages([ ["_CPToolbarView/toolbar-background-top.png", 1, 1, bundle], ["_CPToolbarView/toolbar-background-center.png", 1, 57.0, bundle], - ["_CPToolbarView/toolbar-background-bottom.png", 1, 1, bundle], + ["_CPToolbarView/toolbar-background-bottom.png", 1, 1, bundle] ], CPColorPatternIsVertical); } diff --git a/AppKit/Cib/CPCib.j b/AppKit/Cib/CPCib.j index c9c9a3da0..c1b2a46d6 100644 --- a/AppKit/Cib/CPCib.j +++ b/AppKit/Cib/CPCib.j @@ -61,6 +61,10 @@ var CPCibObjectDataKey = @"CPCibObjectDataKey"; if (self) { _data = [CPURLConnection sendSynchronousRequest:[CPURLRequest requestWithURL:aURL] returningResponse:nil]; + + if (!_data) + return nil; + _awakenCustomResources = YES; } diff --git a/AppKit/Themes/Aristo/ThemeDescriptors.j b/AppKit/Themes/Aristo/ThemeDescriptors.j index e1652f4f3..d5f368fbc 100755 --- a/AppKit/Themes/Aristo/ThemeDescriptors.j +++ b/AppKit/Themes/Aristo/ThemeDescriptors.j @@ -1031,13 +1031,13 @@ var themedButtonValues = nil, [@"editor-inset", CGInsetMake(2.0, 0.0, 0.0, 0.0)], // Non-bezeled token field with tokens - [@"content-inset", CGInsetMake(5.0, 8.0, 4.0, 8.0)], + [@"content-inset", CGInsetMake(6.0, 8.0, 4.0, 8.0)], // Non-bezeled token field with no tokens [@"content-inset", CGInsetMake(7.0, 8.0, 6.0, 8.0), CPTextFieldStatePlaceholder], // Bezeled token field with tokens - [@"content-inset", CGInsetMake(6.0, 8.0, 2.0, 8.0), CPThemeStateBezeled], + [@"content-inset", CGInsetMake(6.0, 5.0, 4.0, 5.0), CPThemeStateBezeled], // Bezeled token field with no tokens [@"content-inset", CGInsetMake(8.0, 8.0, 7.0, 8.0), CPThemeStateBezeled | CPTextFieldStatePlaceholder] @@ -1089,7 +1089,7 @@ var themedButtonValues = nil, [@"text-color", textHighlightedColor, CPThemeStateHighlighted], [@"bezel-inset", CGInsetMakeZero(), CPThemeStateBezeled], - [@"content-inset", CGInsetMake(1.0, 22.0, 3.0, 15.0), CPThemeStateBezeled], + [@"content-inset", CGInsetMake(2.0, 22.0, 2.0, 15.0), CPThemeStateBezeled], // Minimum height == maximum height since tokens are fixed height. [@"min-size", CGSizeMake(0.0, 19.0)], diff --git a/AppKit/_CPAutocompleteMenu.j b/AppKit/_CPAutocompleteMenu.j index a79c1ae80..78d1be533 100644 --- a/AppKit/_CPAutocompleteMenu.j +++ b/AppKit/_CPAutocompleteMenu.j @@ -65,7 +65,7 @@ var _CPAutocompleteMenuMaximumHeight = 307; [scrollView setHasHorizontalScroller:NO]; [contentView addSubview:scrollView]; - tableView = [[CPTableView alloc] initWithFrame:CPRectMakeZero()]; + tableView = [[_CPNonFirstResponderTableView alloc] initWithFrame:CPRectMakeZero()]; var tableColumn = [CPTableColumn new]; [tableColumn setResizingMask:CPTableColumnAutoresizingMask]; @@ -251,14 +251,14 @@ var _CPAutocompleteMenuMaximumHeight = 307; return [contentArray objectAtIndex:row]; } -- (void)tableViewSelectionDidChange:(CPNotification)notification +@end + + +@implementation _CPNonFirstResponderTableView : CPTableView + +- (BOOL)acceptsFirstResponder { - // FIXME - // make sure a mouse click in the tableview doesn't steal first responder state - window.setTimeout(function() - { - [[textField window] makeFirstResponder:textField]; - }, 2.0); + return NO; } @end diff --git a/AppKit/_CPPopUpList.j b/AppKit/_CPPopUpList.j index 20ebac313..10f66136f 100644 --- a/AppKit/_CPPopUpList.j +++ b/AppKit/_CPPopUpList.j @@ -104,7 +104,7 @@ var ListColumnIdentifier = @"1"; _tableView = [self makeTableView]; // Start with a default size, we will resize it later - frame = CGRectMake(0, 0, 200, 200); + var frame = CGRectMake(0, 0, 200, 200); _tableColumn = [[CPTableColumn alloc] initWithIdentifier:ListColumnIdentifier]; [_tableColumn setWidth:CGRectGetWidth(frame) - [CPScroller scrollerWidth]]; @@ -656,6 +656,7 @@ var ListColumnIdentifier = @"1"; else return YES; } + #pragma mark Internal Helpers /*! @ignore */ diff --git a/Objective-J/CFData.js b/Objective-J/CFData.js index f4b08f86b..4075608df 100644 --- a/Objective-J/CFData.js +++ b/Objective-J/CFData.js @@ -229,12 +229,12 @@ CFData.encodeBase64Array = function(input) // pad with "=" and revert array to previous state if (pad > 0) { - output[output.length-1] = "="; + output[output.length - 1] = "="; input.pop(); } if (pad > 1) { - output[output.length-2] = "="; + output[output.length - 2] = "="; input.pop(); } @@ -279,13 +279,12 @@ CFData.bytesToUtf16String = function(bytes) { // Strings are encoded with 16 bits per character. var temp = []; - for (var i = 0; i < bytes.length; i+=2) - temp.push(bytes[i+1] << 8 | bytes[i]); + for (var i = 0; i < bytes.length; i += 2) + temp.push(bytes[i + 1] << 8 | bytes[i]); // This is relatively efficient, I think: return String.fromCharCode.apply(NULL, temp); }; - CFData.encodeBase64Utf16String = function(input) { // charCodeAt returns UTF-16. @@ -293,8 +292,8 @@ CFData.encodeBase64Utf16String = function(input) for (var i = 0; i < input.length; i++) { var c = input.charCodeAt(i); - temp.push(input.charCodeAt(i) & 0xFF); - temp.push((input.charCodeAt(i) & 0xFF00) >> 8); + temp.push(c & 0xFF); + temp.push((c & 0xFF00) >> 8); } return CFData.encodeBase64Array(temp); diff --git a/Tests/AppKit/CPEventTest.j b/Tests/AppKit/CPEventTest.j index 160024ad2..0313a7ba4 100644 --- a/Tests/AppKit/CPEventTest.j +++ b/Tests/AppKit/CPEventTest.j @@ -1,9 +1,16 @@ +@import @import @implementation CPEventTest : OJTestCase { } +- (void)setUp +{ + // CPApplication must be initialised for some event handling to work. + [CPApplication sharedApplication]; +} + /*! This test isn't very useful but it checks for any trouble related to issue #1202. */ @@ -16,4 +23,35 @@ [self assert:0 equals:[anEvent deltaZ] message:"default event delta Z should be 0"]; } -@end \ No newline at end of file +- (void)testDescription +{ + var anEvent = [CPEvent mouseEventWithType:CPLeftMouseUp location:CGPointMake(50, 50) modifierFlags:CPShiftKeyMask + timestamp:400.5 windowNumber:300 context:nil eventNumber:0 clickCount:2 pressure:0.5]; + [self assert:@"CPEvent: type=2 loc={50, 50} time=400.5 flags=0x20000 win=undefined winNum=0 ctxt=null evNum=0 click=2 buttonNumber=0 pressure=0.5" equals:[anEvent description]]; + + anEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:CPShiftKeyMask | CPCommandKeyMask timestamp:12345.6 windowNumber:10 context:nil characters:"X" charactersIgnoringModifiers:"x" isARepeat:NO keyCode:10]; + + [self assert:@"CPEvent: type=10 loc={0, 0} time=12345.6 flags=0x120000 win=null winNum=10 ctxt=null chars=\"X\" unmodchars=\"x\" repeat=0 keyCode=10" equals:[anEvent description]]; + + anEvent = [CPEvent otherEventWithType:CPApplicationDefined location:CGPointMakeZero() modifierFlags:0 timestamp:500.5 windowNumber:2 context:nil subtype:5 data1:15 data2:25]; + + [self assert:@"CPEvent: type=15 loc={0, 0} time=500.5 flags=0x0 win=null winNum=0 ctxt=null subtype=5 data1=15 data2=25" equals:[anEvent description]]; +} + +- (void)testModifierFlags +{ + [self assert:0 equals:[CPEvent modifierFlags] message:@"no modifier flags active in a newly started app"]; + + var anEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:CPShiftKeyMask timestamp:0 windowNumber:0 context:nil characters:"A" charactersIgnoringModifiers:"a" isARepeat:NO keyCode:0]; + [CPApp sendEvent:anEvent]; + + [self assert:CPShiftKeyMask equals:[CPEvent modifierFlags] message:@"shift key pressed"]; + + // When the key up event is sent the modifier flags are cleared. + anEvent = [CPEvent keyEventWithType:CPKeyUp location:CGPointMakeZero() modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:"A" charactersIgnoringModifiers:"a" isARepeat:NO keyCode:0]; + [CPApp sendEvent:anEvent]; + + [self assert:0 equals:[CPEvent modifierFlags] message:@"shift key released"]; +} + +@end diff --git a/Tests/AppKit/CPTableViewTest.j b/Tests/AppKit/CPTableViewTest.j index e07a63664..a65de663f 100644 --- a/Tests/AppKit/CPTableViewTest.j +++ b/Tests/AppKit/CPTableViewTest.j @@ -4,6 +4,7 @@ @implementation CPTableViewTest : OJTestCase { + CPWindow theWindow; CPTableView tableView; CPTableColumn tableColumn; @@ -15,19 +16,21 @@ - (void)setUp { // setup a reasonable table - tableView = [[CPTableView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; + theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 1024.0, 768.0) + styleMask:CPWindowNotSizable]; + + tableView = [[FirstResponderConfigurableTableView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; tableColumn = [[CPTableColumn alloc] initWithIdentifier:@"Foo"]; + tableView.acceptsFirstResponder = YES; [tableView addTableColumn:tableColumn]; + + [[theWindow contentView] addSubview:tableView]; } - (void)testDoubleAction { doubleActionReceived = NO; - var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 1024.0, 768.0) - styleMask:CPWindowNotSizable]; - [[theWindow contentView] addSubview:tableView]; - [tableView setTarget:self]; [tableView setDoubleAction:@selector(doubleAction:)]; @@ -44,6 +47,20 @@ [tableView trackMouse:dblClkUp]; [self assertTrue:doubleActionReceived]; + + // The event should also work even if the table is not the first responder. + tableView.acceptsFirstResponder = NO; + [theWindow makeFirstResponder:nil]; + + doubleActionReceived = NO; + + [[CPApplication sharedApplication] sendEvent:dblClkDown]; + [tableView trackMouse:dblClkDown]; + + [[CPApplication sharedApplication] sendEvent:dblClkUp]; + [tableView trackMouse:dblClkUp]; + + [self assertTrue:doubleActionReceived]; } - (void)doubleAction:(id)sender @@ -124,11 +141,6 @@ */ - (void)testEditCell { - var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0, 0, 200, 150) - styleMask:CPWindowNotSizable]; - - [[theWindow contentView] addSubview:tableView]; - var dataSource = [TestDataSource new]; [dataSource setTableEntries:["A", "B", "C"]]; @@ -230,9 +242,7 @@ - (void)testContentBinding { - var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0, 0, 200, 150) - styleMask:CPWindowNotSizable], - contentBindingTable = [[CPTableView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)], + var contentBindingTable = [[CPTableView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)], tableColumn = [[CPTableColumn alloc] initWithIdentifier:@"A"], delegate = [ContentBindingTableDelegate new]; @@ -259,6 +269,18 @@ @end +@implementation FirstResponderConfigurableTableView : CPTableView +{ + BOOL acceptsFirstResponder; +} + +- (BOOL)acceptsFirstResponder +{ + return acceptsFirstResponder; +} + +@end + @implementation TestDataSource : CPObject { CPArray tableEntries @accessors; diff --git a/Tests/Foundation/CPUndoManagerTest.j b/Tests/Foundation/CPUndoManagerTest.j index 67ef6308c..480d4a0ed 100644 --- a/Tests/Foundation/CPUndoManagerTest.j +++ b/Tests/Foundation/CPUndoManagerTest.j @@ -52,7 +52,6 @@ // The default run loop undo grouping won't be closed until the next run loop cycle. [[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode]; - CPLog.error("receivedNotifications: %@", receivedNotifications); [self assert:CPUndoManagerDidCloseUndoGroupNotification equals:[receivedNotifications[0] name]]; [[CPNotificationCenter defaultCenter] removeObserver:self]; diff --git a/Tests/Manual/TableTest/OldTest/AppController.j b/Tests/Manual/TableTest/OldTest/AppController.j index c72f7746e..901a9bafd 100644 --- a/Tests/Manual/TableTest/OldTest/AppController.j +++ b/Tests/Manual/TableTest/OldTest/AppController.j @@ -10,6 +10,7 @@ tableTestDragType = @"CPTableViewTestDragType"; CPImage iconImage; CPArray dataSet1; CPArray dataSet2; + CPArray dataSet3; CPTableColumn randomColumn; } @@ -28,9 +29,15 @@ tableTestDragType = @"CPTableViewTestDragType"; } var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(50,50,700,500) styleMask:CPClosableWindowMask], - contentView = [theWindow contentView]; + contentView = [theWindow contentView], + label = [CPTextField new]; - tableView = [[CPTableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 400.0)]; + [label setStringValue:@"This table refuses to become the first responder but can still be interacted with."]; + [label sizeToFit]; + [label setFrameOrigin:CGPointMake(200, 10)] + [contentView addSubview:label]; + + tableView = [[CUTableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 400.0)]; [tableView setAllowsMultipleSelection:YES]; [tableView setAllowsColumnSelection:YES]; @@ -172,7 +179,6 @@ tableTestDragType = @"CPTableViewTestDragType"; - (void)newWindow { - var window2 = [[CPWindow alloc] initWithContentRect:CGRectMake(450, 50, 500, 400) styleMask:CPTitledWindowMask | CPResizableWindowMask]; tableView2 = [[CPTableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 500.0, 500.0)]; @@ -186,7 +192,6 @@ tableTestDragType = @"CPTableViewTestDragType"; [tableView2 setDelegate:self]; [tableView2 setDataSource:self]; - var checkBox = [[CPCheckBox alloc] initWithFrame:CGRectMake(5,3,24,24)], checkBoxColumn = [[CPTableColumn alloc] initWithIdentifier:@"checkBox"]; [checkBoxColumn setDataView:checkBox]; @@ -299,20 +304,9 @@ tableTestDragType = @"CPTableViewTestDragType"; [aTableView reloadData]; } - -- (void)tableViewSelectionIsChanging:(CPNotification)aNotification -{ - //CPLog.debug(@"changing! %@", [aNotification description]); -} - -- (void)tableViewSelectionDidChange:(CPNotification)aNotification -{ - //CPLog.debug(@"did change! %@", [aNotification description]); -} - - (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(int)rowIndex { - //CPLog.debug(@"tableView:shouldSelectRow"); + CPLog.debug(@"tableView:shouldSelectRow"); return true; } @@ -324,18 +318,19 @@ tableTestDragType = @"CPTableViewTestDragType"; - (void)tableViewSelectionDidChange:(id)notification { - //CPLogConsole(_cmd + [notification description]); + CPLogConsole(_cmd + [notification description]); } - (void)tableViewSelectionIsChanging:(id)notification { - //CPLogConsole(_cmd + [notification description]); + CPLogConsole(_cmd + [notification description]); } - (void)_tableViewColumnDidResize:(id)notification { - //CPLogConsole(_cmd + [notification description]); + CPLogConsole(_cmd + [notification description]); } + - (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)tableColumn row:(int)row { if (aTableView === tableView3) @@ -425,8 +420,8 @@ tableTestDragType = @"CPTableViewTestDragType"; } else { - var destIndexes = [CPIndexSet indexSetWithIndexesInRange:CPMakeRange(row, [sourceIndexes count])]; - var sourceObjects = [sourceDataSet objectsAtIndexes:sourceIndexes]; + var destIndexes = [CPIndexSet indexSetWithIndexesInRange:CPMakeRange(row, [sourceIndexes count])], + sourceObjects = [sourceDataSet objectsAtIndexes:sourceIndexes]; [destinationDataSet insertObjects:sourceObjects atIndexes:destIndexes]; [destinationTable reloadData]; @@ -485,3 +480,16 @@ tableTestDragType = @"CPTableViewTestDragType"; } @end + + +@implementation CUTableView : CPTableView +{ + +} + +- (BOOL)acceptsFirstResponder +{ + return NO; +} + +@end