mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Merge pull request #1974 from mrcarlberg/protocol
Protocol support for Objective-J
This commit is contained in:
+1
-1
@@ -757,7 +757,7 @@ var bottomHeight = 71;
|
||||
return @"alert";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"size": CGSizeMake(400.0, 110.0),
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ CPBelowBottom = 6;
|
||||
return @"box";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"background-color": [CPNull null],
|
||||
|
||||
+13
-13
@@ -71,7 +71,7 @@
|
||||
return "browser";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"image-control-resize": [CPNull null],
|
||||
@@ -171,7 +171,7 @@
|
||||
[self addColumn];
|
||||
}
|
||||
|
||||
- (void)setLastColumn:(int)columnIndex
|
||||
- (void)setLastColumn:(CPInteger)columnIndex
|
||||
{
|
||||
if (columnIndex >= _tableViews.length)
|
||||
return;
|
||||
@@ -291,7 +291,7 @@
|
||||
[aTableView addTableColumn:column];
|
||||
}
|
||||
|
||||
- (void)reloadColumn:(int)column
|
||||
- (void)reloadColumn:(CPInteger)column
|
||||
{
|
||||
[[self tableViewInColumn:column] reloadData];
|
||||
}
|
||||
@@ -359,7 +359,7 @@
|
||||
|
||||
// ITEMS
|
||||
|
||||
- (id)itemAtRow:(int)row inColumn:(int)column
|
||||
- (id)itemAtRow:(CPInteger)row inColumn:(CPInteger)column
|
||||
{
|
||||
return [_tableDelegates[column] childAtIndex:row];
|
||||
}
|
||||
@@ -369,7 +369,7 @@
|
||||
return [_delegate respondsToSelector:@selector(browser:isLeafItem:)] && [_delegate browser:self isLeafItem:item];
|
||||
}
|
||||
|
||||
- (id)parentForItemsInColumn:(int)column
|
||||
- (id)parentForItemsInColumn:(CPInteger)column
|
||||
{
|
||||
return [_tableDelegates[column] _item];
|
||||
}
|
||||
@@ -652,7 +652,7 @@
|
||||
[_tableViews makeObjectsPerformSelector:@selector(registerForDraggedTypes:) withObject:types];
|
||||
}
|
||||
|
||||
- (BOOL)canDragRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(int)columnIndex withEvent:(CPEvent)dragEvent
|
||||
- (BOOL)canDragRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)columnIndex withEvent:(CPEvent)dragEvent
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(browser:canDragRowsWithIndexes:inColumn:withEvent:)])
|
||||
return [_delegate browser:self canDragRowsWithIndexes:rowIndexes inColumn:columnIndex withEvent:dragEvent];
|
||||
@@ -660,7 +660,7 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (CPImage)draggingImageForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(int)columnIndex withEvent:(CPEvent)dragEvent offset:(CGPoint)dragImageOffset
|
||||
- (CPImage)draggingImageForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)columnIndex withEvent:(CPEvent)dragEvent offset:(CGPoint)dragImageOffset
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(browser:draggingImageForRowsWithIndexes:inColumn:withEvent:offset:)])
|
||||
return [_delegate browser:self draggingImageForRowsWithIndexes:rowIndexes inColumn:columnIndex withEvent:dragEvent offset:dragImageOffset];
|
||||
@@ -668,7 +668,7 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (CPView)draggingViewForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(int)columnIndex withEvent:(CPEvent)dragEvent offset:(CGPoint)dragImageOffset
|
||||
- (CPView)draggingViewForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)columnIndex withEvent:(CPEvent)dragEvent offset:(CGPoint)dragImageOffset
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(browser:draggingViewForRowsWithIndexes:inColumn:withEvent:offset:)])
|
||||
return [_delegate browser:self draggingViewForRowsWithIndexes:rowIndexes inColumn:columnIndex withEvent:dragEvent offset:dragImageOffset];
|
||||
@@ -771,7 +771,7 @@
|
||||
CPBrowser _browser @accessors;
|
||||
}
|
||||
|
||||
- (void)initWithFrame:(CGRect)aFrame
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
if (self = [super initWithFrame:aFrame])
|
||||
{
|
||||
@@ -902,12 +902,12 @@
|
||||
[_browser selectRowIndexes:selectedIndexes inColumn:_index];
|
||||
}
|
||||
|
||||
- (id)childAtIndex:(unsigned)index
|
||||
- (id)childAtIndex:(CPUInteger)index
|
||||
{
|
||||
return [_delegate browser:_browser child:index ofItem:_item];
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(int)row dropOperation:(CPTableViewDropOperation)operation
|
||||
- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)operation
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(browser:acceptDrop:atRow:column:dropOperation:)])
|
||||
return [_delegate browser:_browser acceptDrop:info atRow:row column:_index dropOperation:operation];
|
||||
@@ -915,7 +915,7 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)operation
|
||||
- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id)info proposedRow:(CPInteger)row proposedDropOperation:(CPTableViewDropOperation)operation
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(browser:validateDrop:proposedRow:column:dropOperation:)])
|
||||
return [_delegate browser:_browser validateDrop:info proposedRow:row column:_index dropOperation:operation];
|
||||
@@ -995,7 +995,7 @@
|
||||
[aCoder encodeObject:_highlightedBranchImage forKey:"_CPBrowserLeafViewHighlightedBranchImageKey"];
|
||||
}
|
||||
|
||||
- (void)initWithCoder:(CPCoder)aCoder
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
if (self = [super initWithCoder:aCoder])
|
||||
{
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ CPButtonImageOffset = 3.0;
|
||||
return @"button";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"image": [CPNull null],
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
return @"button-bar";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"resize-control-inset": CGInsetMake(0.0, 0.0, 0.0, 0.0),
|
||||
|
||||
@@ -830,7 +830,7 @@ var HORIZONTAL_MARGIN = 2;
|
||||
[self tile];
|
||||
}
|
||||
|
||||
- (void)setUniformSubviewsResizing:(float)flag
|
||||
- (void)setUniformSubviewsResizing:(BOOL)flag
|
||||
{
|
||||
_uniformSubviewsResizing = flag;
|
||||
[self tileIfNeeded:NO];
|
||||
@@ -892,12 +892,12 @@ var HORIZONTAL_MARGIN = 2;
|
||||
return CPNotFound;
|
||||
}
|
||||
|
||||
- (CPCollectionViewItem)itemAtIndex:(unsigned)anIndex
|
||||
- (CPCollectionViewItem)itemAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
return [_items objectAtIndex:anIndex];
|
||||
}
|
||||
|
||||
- (CGRect)frameForItemAtIndex:(unsigned)anIndex
|
||||
- (CGRect)frameForItemAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
return [[[self itemAtIndex:anIndex] view] frame];
|
||||
}
|
||||
@@ -1322,7 +1322,7 @@ Not supported. Use -collectionView:dataForItemsAtIndexes:fortype:
|
||||
[self interpretKeyEvents:[anEvent]];
|
||||
}
|
||||
|
||||
- (void)setAutoresizingMask:(int)aMask
|
||||
- (void)setAutoresizingMask:(unsigned)aMask
|
||||
{
|
||||
[super setAutoresizingMask:0];
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ var CPColorPanelSwatchesCookie = "CPColorPanelSwatchesCookie";
|
||||
[aPasteboard setData:[CPKeyedArchiver archivedDataWithRootObject:_dragColor] forType:aType];
|
||||
}
|
||||
|
||||
- (void)performDragOperation:(id <CPDraggingInfo>)aSender
|
||||
- (void)performDragOperation:(id /*<CPDraggingInfo>*/)aSender
|
||||
{
|
||||
var location = [self convertPoint:[aSender draggingLocation] fromView:nil],
|
||||
pasteboard = [aSender draggingPasteboard],
|
||||
@@ -615,7 +615,7 @@ var CPColorPanelSwatchesCookie = "CPColorPanelSwatchesCookie";
|
||||
return _colorPanel;
|
||||
}
|
||||
|
||||
- (void)performDragOperation:(id <CPDraggingInfo>)aSender
|
||||
- (void)performDragOperation:(id /*<CPDraggingInfo>*/)aSender
|
||||
{
|
||||
var pasteboard = [aSender draggingPasteboard];
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
|
||||
return @"colorwell";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"bezel-inset": CGInsetMakeZero(),
|
||||
|
||||
+5
-5
@@ -58,7 +58,7 @@ var CPComboBoxTextSubview = @"text",
|
||||
return "combobox";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"popup-button-size": CGSizeMake(21.0, 29.0),
|
||||
@@ -171,7 +171,7 @@ var CPComboBoxTextSubview = @"text",
|
||||
|
||||
#pragma mark Setting a Delegate
|
||||
|
||||
- (id < CPComboBoxDelegate >)delegate
|
||||
- (id /*< CPComboBoxDelegate >*/)delegate
|
||||
{
|
||||
return [super delegate];
|
||||
}
|
||||
@@ -182,7 +182,7 @@ var CPComboBoxTextSubview = @"text",
|
||||
protocol, in actual fact it doesn't. Also note that the same
|
||||
delegate may conform to the NSTextFieldDelegate protocol.
|
||||
*/
|
||||
- (void)setDelegate:(id < CPComboBoxDelegate >)aDelegate
|
||||
- (void)setDelegate:(id /*< CPComboBoxDelegate >*/)aDelegate
|
||||
{
|
||||
var delegate = [self delegate];
|
||||
|
||||
@@ -231,7 +231,7 @@ var CPComboBoxTextSubview = @"text",
|
||||
|
||||
#pragma mark Setting a Data Source
|
||||
|
||||
- (id < CPComboBoxDataSource >)dataSource
|
||||
- (id /*< CPComboBoxDataSource >*/)dataSource
|
||||
{
|
||||
if (!_usesDataSource)
|
||||
[self _dataSourceWarningForMethod:_cmd condition:NO];
|
||||
@@ -239,7 +239,7 @@ var CPComboBoxTextSubview = @"text",
|
||||
return _dataSource;
|
||||
}
|
||||
|
||||
- (void)setDataSource:(id < CPComboBoxDataSource >)aSource
|
||||
- (void)setDataSource:(id /*< CPComboBoxDataSource >*/)aSource
|
||||
{
|
||||
if (!_usesDataSource)
|
||||
[self _dataSourceWarningForMethod:_cmd condition:NO];
|
||||
|
||||
+3
-3
@@ -322,11 +322,11 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
_previousTrackingLocation = currentLocation;
|
||||
}
|
||||
|
||||
- (void)setState:(int)state
|
||||
- (void)setState:(CPInteger)state
|
||||
{
|
||||
}
|
||||
|
||||
- (int)nextState
|
||||
- (CPInteger)nextState
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -855,7 +855,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
/*!
|
||||
Returns the image scaling of the control.
|
||||
*/
|
||||
- (CPImageScaling)imageScaling
|
||||
- (CPUInteger)imageScaling
|
||||
{
|
||||
return [self valueForThemeAttribute:@"image-scaling"];
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
//CPCalendar _calendar @accessors(property=calendar);
|
||||
CPTimeZone _timeZone @accessors(property=timeZone);
|
||||
id _delegate @accessors(property=delegate);
|
||||
unsigned _datePickerElements @accessors(property=datePickerElements);
|
||||
CPInteger _datePickerElements @accessors(property=datePickerElements);
|
||||
CPInteger _datePickerMode @accessors(property=datePickerMode);
|
||||
CPInteger _datePickerStyle @accessors(property=datePickerStyle);
|
||||
CPInteger _timeInterval @accessors(property=timeInterval);
|
||||
@@ -90,7 +90,7 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
return @"datePicker";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"bezel-color": [CPColor clearColor],
|
||||
@@ -159,7 +159,7 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
return [super _binderClassForBinding:theBinding];
|
||||
}
|
||||
|
||||
- (id)_replacementKeyPathForBinding:(CPString)aBinding
|
||||
- (CPString)_replacementKeyPathForBinding:(CPString)aBinding
|
||||
{
|
||||
if (aBinding == CPValueBinding)
|
||||
return @"dateValue";
|
||||
@@ -269,7 +269,7 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
|
||||
/*! Return the objectValue of the datePicker. The objectValue should take the timeZoneEffect
|
||||
*/
|
||||
- (void)objectValue
|
||||
- (id)objectValue
|
||||
{
|
||||
// TODO : add timeZone effect. How to do it because js ???
|
||||
return _dateValue
|
||||
@@ -366,7 +366,7 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
/*! Set the syle of the datePicker
|
||||
@param aDatePickerStyle the datePicker style
|
||||
*/
|
||||
- (void)setDatePickerStyle:(CPDate)aDatePickerStyle
|
||||
- (void)setDatePickerStyle:(CPInteger)aDatePickerStyle
|
||||
{
|
||||
_datePickerStyle = aDatePickerStyle;
|
||||
|
||||
@@ -377,7 +377,7 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
/*! Set the elements of the datePicker
|
||||
@param aDatePickerElements the datePicker elements
|
||||
*/
|
||||
- (void)setDatePickerElements:(CPDate)aDatePickerElements
|
||||
- (void)setDatePickerElements:(CPInteger)aDatePickerElements
|
||||
{
|
||||
_datePickerElements = aDatePickerElements;
|
||||
|
||||
@@ -388,7 +388,7 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
/*! Set the mode of the datePicker
|
||||
@param aDatePickerMode the datePicker mode
|
||||
*/
|
||||
- (void)setDatePickerMode:(CPDate)aDatePickerMode
|
||||
- (void)setDatePickerMode:(CPInteger)aDatePickerMode
|
||||
{
|
||||
_datePickerMode = aDatePickerMode;
|
||||
|
||||
@@ -688,4 +688,4 @@ var CPDatePickerModeKey = @"CPDatePickerModeKey",
|
||||
self.setMilliseconds(99);
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
@@ -1059,7 +1059,7 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
|
||||
/*! Set a theme
|
||||
*/
|
||||
- (void)setThemeState:(CPThemeState)aState
|
||||
- (BOOL)setThemeState:(CPThemeState)aState
|
||||
{
|
||||
[_textField setThemeState:aState];
|
||||
[super setThemeState:aState];
|
||||
@@ -1067,7 +1067,7 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
|
||||
/*! Unset a theme
|
||||
*/
|
||||
- (void)unsetThemeState:(CPThemeState)aState
|
||||
- (BOOL)unsetThemeState:(CPThemeState)aState
|
||||
{
|
||||
[_textField unsetThemeState:aState];
|
||||
[super unsetThemeState:aState];
|
||||
|
||||
@@ -1356,7 +1356,7 @@ var CPMonthDateType = 0,
|
||||
/*! Set the stringValue of the TextField. Add some zeros of there isn't 2/4 letters in the value. It's called at the end of the editing process
|
||||
@param aStringValue a CPString
|
||||
*/
|
||||
- (void)setStringValue:(id)aStringValue
|
||||
- (void)setStringValue:(CPString)aStringValue
|
||||
{
|
||||
if (_dateType == CPYearDateType)
|
||||
{
|
||||
@@ -1437,7 +1437,7 @@ var CPMonthDateType = 0,
|
||||
/*! Return the objectValue of the textField. Needed for the binding.
|
||||
This returns the objectValue relative to the dateValue
|
||||
*/
|
||||
- (void)objectValue
|
||||
- (id)objectValue
|
||||
{
|
||||
var dateValue = [[_datePicker dateValue] copy];
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
|
||||
return @"CPFV_" + [self UID];
|
||||
}
|
||||
|
||||
- (void)mouseMoved:(id)sommit
|
||||
- (void)mouseMoved:(CPEvent)sommit
|
||||
{
|
||||
[[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ var CPImageViewEmptyPlaceholderImage = nil;
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
- (unsigned)imageScaling
|
||||
- (CPUInteger)imageScaling
|
||||
{
|
||||
return [self currentValueForThemeAttribute:@"image-scaling"];
|
||||
}
|
||||
@@ -502,7 +502,7 @@ var CPImageViewEmptyPlaceholderImage = nil;
|
||||
[_source setImage:image];
|
||||
}
|
||||
|
||||
- (void)valueForBinding:(CPString)aBinding
|
||||
- (id)valueForBinding:(CPString)aBinding
|
||||
{
|
||||
var image = [_source image];
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ CPRatingLevelIndicatorStyle = 3;
|
||||
return "level-indicator";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"bezel-color": [CPNull null],
|
||||
|
||||
@@ -278,7 +278,7 @@ var _CPMenuBarVisible = NO,
|
||||
@param aMenuItem the item to insert
|
||||
@param anIndex the index in the menu to insert the item.
|
||||
*/
|
||||
- (void)insertItem:(CPMenuItem)aMenuItem atIndex:(unsigned)anIndex
|
||||
- (void)insertItem:(CPMenuItem)aMenuItem atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
[self insertObject:aMenuItem inItemsAtIndex:anIndex];
|
||||
}
|
||||
@@ -291,7 +291,7 @@ var _CPMenuBarVisible = NO,
|
||||
@param anIndex the index location in the menu for the new item
|
||||
@return the new menu item
|
||||
*/
|
||||
- (CPMenuItem)insertItemWithTitle:(CPString)aTitle action:(SEL)anAction keyEquivalent:(CPString)aKeyEquivalent atIndex:(unsigned)anIndex
|
||||
- (CPMenuItem)insertItemWithTitle:(CPString)aTitle action:(SEL)anAction keyEquivalent:(CPString)aKeyEquivalent atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
var item = [[CPMenuItem alloc] initWithTitle:aTitle action:anAction keyEquivalent:aKeyEquivalent];
|
||||
|
||||
@@ -335,7 +335,7 @@ var _CPMenuBarVisible = NO,
|
||||
Removes the item at the specified index from the menu
|
||||
@param anIndex the index of the item to remove
|
||||
*/
|
||||
- (void)removeItemAtIndex:(unsigned)anIndex
|
||||
- (void)removeItemAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
[self removeObjectFromItemsAtIndex:anIndex];
|
||||
}
|
||||
@@ -1061,7 +1061,7 @@ var _CPMenuBarVisible = NO,
|
||||
Sends the action of the menu item at the specified index.
|
||||
@param anIndex the index of the item
|
||||
*/
|
||||
- (void)performActionForItemAtIndex:(unsigned)anIndex
|
||||
- (void)performActionForItemAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
var item = _items[anIndex];
|
||||
|
||||
|
||||
@@ -435,7 +435,7 @@ _CPMenuWindowAttachedMenuBackgroundStyle = 2;
|
||||
return "menu-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"menu-window-more-above-image": [CPNull null],
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
return "menu-item-bar-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"horizontal-margin": 9.0,
|
||||
@@ -84,25 +84,25 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CPColor)setTextColor:(CPColor)aColor
|
||||
- (void)setTextColor:(CPColor)aColor
|
||||
{
|
||||
_textColor = aColor;
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (CPColor)setTextShadowColor:(CPColor)aColor
|
||||
- (void)setTextShadowColor:(CPColor)aColor
|
||||
{
|
||||
_textShadowColor = aColor;
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (CPColor)setHighlightTextColor:(CPColor)aColor
|
||||
- (void)setHighlightTextColor:(CPColor)aColor
|
||||
{
|
||||
_highlightTextColor = aColor;
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (CPColor)setHighlightTextShadowColor:(CPColor)aColor
|
||||
- (void)setHighlightTextShadowColor:(CPColor)aColor
|
||||
{
|
||||
_highlightTextShadowColor = aColor;
|
||||
[self setNeedsLayout];
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
return "menu-item-standard-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"submenu-indicator-color": [CPNull null],
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
return "menu-item-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{};
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
CPCountedSet _observedKeys;
|
||||
}
|
||||
|
||||
+ (id)initialize
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self !== [CPObjectController class])
|
||||
return;
|
||||
@@ -572,7 +572,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo
|
||||
}
|
||||
}
|
||||
|
||||
- (void)insertObject:(id)anObject atIndex:(unsigned)anIndex
|
||||
- (void)insertObject:(id)anObject atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
for (var i = 0, count = [_observationProxies count]; i < count; i++)
|
||||
{
|
||||
@@ -592,7 +592,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo
|
||||
[super insertObject:anObject atIndex:anIndex];
|
||||
}
|
||||
|
||||
- (void)removeObjectAtIndex:(unsigned)anIndex
|
||||
- (void)removeObjectAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
var currentObject = [self objectAtIndex:anIndex];
|
||||
|
||||
@@ -614,7 +614,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo
|
||||
[super removeObjectAtIndex:anIndex];
|
||||
}
|
||||
|
||||
- (_CPObservableArray)objectsAtIndexes:(CPIndexSet)theIndexes
|
||||
- (CPArray)objectsAtIndexes:(CPIndexSet)theIndexes
|
||||
{
|
||||
return [_CPObservableArray arrayWithArray:[super objectsAtIndexes:theIndexes]];
|
||||
}
|
||||
@@ -629,7 +629,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo
|
||||
[self removeObjectAtIndex:[self count]];
|
||||
}
|
||||
|
||||
- (void)replaceObjectAtIndex:(unsigned)anIndex withObject:(id)anObject
|
||||
- (void)replaceObjectAtIndex:(CPUInteger)anIndex withObject:(id)anObject
|
||||
{
|
||||
var currentObject = [self objectAtIndex:anIndex];
|
||||
|
||||
|
||||
+15
-15
@@ -1078,7 +1078,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
@ignore
|
||||
We need to offset the dataview and add the disclosure triangle.
|
||||
*/
|
||||
- (CPView)_dragViewForColumn:(int)theColumnIndex event:(CPEvent)theDragEvent offset:(CGPoint)theDragViewOffset
|
||||
- (CPView)_dragViewForColumn:(CPInteger)theColumnIndex event:(CPEvent)theDragEvent offset:(CGPoint)theDragViewOffset
|
||||
{
|
||||
var dragView = [[_CPColumnDragView alloc] initWithLineColor:[self gridColor]],
|
||||
tableColumn = [[self tableColumns] objectAtIndex:theColumnIndex],
|
||||
@@ -1211,7 +1211,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (id)_parentItemForUpperRow:(int)theUpperRowIndex andLowerRow:(int)theLowerRowIndex atMouseOffset:(CGPoint)theOffset
|
||||
- (id)_parentItemForUpperRow:(CPInteger)theUpperRowIndex andLowerRow:(CPInteger)theLowerRowIndex atMouseOffset:(CGPoint)theOffset
|
||||
{
|
||||
if (_shouldRetargetItem)
|
||||
return _retargetedItem;
|
||||
@@ -1241,7 +1241,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (CGRect)_rectForDropHighlightViewBetweenUpperRow:(int)theUpperRowIndex andLowerRow:(int)theLowerRowIndex offset:(CGPoint)theOffset
|
||||
- (CGRect)_rectForDropHighlightViewBetweenUpperRow:(CPInteger)theUpperRowIndex andLowerRow:(CPInteger)theLowerRowIndex offset:(CGPoint)theOffset
|
||||
{
|
||||
// Call super and the update x to reflect the current indentation level
|
||||
var rect = [super _rectForDropHighlightViewBetweenUpperRow:theUpperRowIndex andLowerRow:theLowerRowIndex offset:theOffset],
|
||||
@@ -1807,7 +1807,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
return [_outlineView._outlineViewDataSource outlineView:_outlineView writeItems:items toPasteboard:thePasteboard];
|
||||
}
|
||||
|
||||
- (int)_childIndexForDropOperation:(CPTableViewDropOperation)theDropOperation row:(int)theRow offset:(CGPoint)theOffset
|
||||
- (int)_childIndexForDropOperation:(CPTableViewDropOperation)theDropOperation row:(CPInteger)theRow offset:(CGPoint)theOffset
|
||||
{
|
||||
if (_outlineView._shouldRetargetChildIndex)
|
||||
return _outlineView._retargedChildIndex;
|
||||
@@ -1831,7 +1831,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
return childIndex;
|
||||
}
|
||||
|
||||
- (void)_parentItemForDropOperation:(CPTableViewDropOperation)theDropOperation row:(int)theRow offset:(CGPoint)theOffset
|
||||
- (void)_parentItemForDropOperation:(CPTableViewDropOperation)theDropOperation row:(CPInteger)theRow offset:(CGPoint)theOffset
|
||||
{
|
||||
if (theDropOperation === CPTableViewDropAbove)
|
||||
return [_outlineView _parentItemForUpperRow:theRow - 1 andLowerRow:theRow atMouseOffset:theOffset]
|
||||
@@ -1839,8 +1839,8 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
return [_outlineView itemAtRow:theRow];
|
||||
}
|
||||
|
||||
- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id < CPDraggingInfo >)theInfo
|
||||
proposedRow:(int)theRow proposedDropOperation:(CPTableViewDropOperation)theOperation
|
||||
- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id /*< CPDraggingInfo >*/)theInfo
|
||||
proposedRow:(CPInteger)theRow proposedDropOperation:(CPTableViewDropOperation)theOperation
|
||||
{
|
||||
if (!(_outlineView._implementedOutlineViewDataSourceMethods & CPOutlineViewDataSource_outlineView_validateDrop_proposedItem_proposedChildIndex_))
|
||||
return CPDragOperationNone;
|
||||
@@ -1859,7 +1859,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
return [_outlineView._outlineViewDataSource outlineView:_outlineView validateDrop:theInfo proposedItem:parentItem proposedChildIndex:childIndex];
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id <CPDraggingInfo>)theInfo row:(int)theRow dropOperation:(CPTableViewDropOperation)theOperation
|
||||
- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id /*<CPDraggingInfo>*/)theInfo row:(CPInteger)theRow dropOperation:(CPTableViewDropOperation)theOperation
|
||||
{
|
||||
if (!(_outlineView._implementedOutlineViewDataSourceMethods & CPOutlineViewDataSource_outlineView_acceptDrop_item_childIndex_))
|
||||
return NO;
|
||||
@@ -1903,7 +1903,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(CPTableView)theTableView shouldSelectRow:(int)theRow
|
||||
- (BOOL)tableView:(CPTableView)theTableView shouldSelectRow:(CPInteger)theRow
|
||||
{
|
||||
return SHOULD_SELECT_ITEM(_outlineView, [_outlineView itemAtRow:theRow]);
|
||||
}
|
||||
@@ -1913,7 +1913,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
return SELECTION_SHOULD_CHANGE(_outlineView);
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aColumn row:(int)aRow
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow
|
||||
{
|
||||
if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_shouldEditTableColumn_item_))
|
||||
return [_outlineView._outlineViewDelegate outlineView:_outlineView shouldEditTableColumn:aColumn item:[_outlineView itemAtRow:aRow]];
|
||||
@@ -1921,7 +1921,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (float)tableView:(CPTableView)theTableView heightOfRow:(int)theRow
|
||||
- (float)tableView:(CPTableView)theTableView heightOfRow:(CPInteger)theRow
|
||||
{
|
||||
if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_heightOfRowByItem_))
|
||||
return [_outlineView._outlineViewDelegate outlineView:_outlineView heightOfRowByItem:[_outlineView itemAtRow:theRow]];
|
||||
@@ -1929,7 +1929,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
return [theTableView rowHeight];
|
||||
}
|
||||
|
||||
- (void)tableView:(CPTableView)aTableView willDisplayView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex
|
||||
- (void)tableView:(CPTableView)aTableView willDisplayView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
|
||||
{
|
||||
if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_willDisplayView_forTableColumn_item_))
|
||||
{
|
||||
@@ -1938,7 +1938,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(int)aRow
|
||||
- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(CPInteger)aRow
|
||||
{
|
||||
if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_isGroupItem_))
|
||||
return [_outlineView._outlineViewDelegate outlineView:_outlineView isGroupItem:[_outlineView itemAtRow:aRow]];
|
||||
@@ -1946,7 +1946,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aTableColumn row:(int)aRow
|
||||
- (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow
|
||||
{
|
||||
if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_menuForTableColumn_item_))
|
||||
{
|
||||
@@ -1992,7 +1992,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setState:(CPState)aState
|
||||
- (void)setState:(CPInteger)aState
|
||||
{
|
||||
[super setState:aState];
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
Selects the item at the specified index
|
||||
@param anIndex the index of the item to select
|
||||
*/
|
||||
- (void)setObjectValue:(int)anIndex
|
||||
- (void)setObjectValue:(id)anIndex
|
||||
{
|
||||
var indexOfSelectedItem = [self objectValue];
|
||||
|
||||
@@ -344,7 +344,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
Returns the item at the specified index or \c nil if the item does not exist.
|
||||
@param anIndex the index of the item to obtain
|
||||
*/
|
||||
- (CPMenuItem)itemAtIndex:(unsigned)anIndex
|
||||
- (CPMenuItem)itemAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
return [[self menu] itemAtIndex:anIndex];
|
||||
}
|
||||
@@ -353,7 +353,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
Returns the title of the item at the specified index or \c nil if no item exists.
|
||||
@param anIndex the index of the item
|
||||
*/
|
||||
- (CPString)itemTitleAtIndex:(unsigned)anIndex
|
||||
- (CPString)itemTitleAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
return [[[self menu] itemAtIndex:anIndex] title];
|
||||
}
|
||||
@@ -838,7 +838,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
[self _setContentValuesIfNeeded:contentArray];
|
||||
}
|
||||
|
||||
- (void)valueForBinding:(CPString)aBinding
|
||||
- (id)valueForBinding:(CPString)aBinding
|
||||
{
|
||||
return [self _content];
|
||||
}
|
||||
@@ -910,7 +910,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setValue:(id)aValue forBinding:(CPString)aBinding
|
||||
- (void)setValue:(CPArray)aValue forBinding:(CPString)aBinding
|
||||
{
|
||||
[super _setContent:aValue];
|
||||
}
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ CPRadioImageOffset = 4.0;
|
||||
[_radioGroup _setSelectedRadio:self];
|
||||
}
|
||||
|
||||
- (void)sendAction:(SEL)anAction to:(id)anObject
|
||||
- (BOOL)sendAction:(SEL)anAction to:(id)anObject
|
||||
{
|
||||
[super sendAction:anAction to:anObject];
|
||||
|
||||
|
||||
@@ -356,7 +356,7 @@ CPDeleteForwardKeyCode = 46;
|
||||
var CPResponderNextResponderKey = @"CPResponderNextResponderKey",
|
||||
CPResponderMenuKey = @"CPResponderMenuKey";
|
||||
|
||||
@implementation CPResponder (CPCoding)
|
||||
@implementation CPResponder (CPCoding) <CPCoding>
|
||||
|
||||
/*!
|
||||
Initializes the responder with data from a coder.
|
||||
|
||||
@@ -484,7 +484,7 @@
|
||||
|
||||
#pragma mark RuleEditor delegate methods
|
||||
|
||||
- (int)_queryNumberOfChildrenOfItem:(id)rowItem withRowType:(int)type
|
||||
- (int)_queryNumberOfChildrenOfItem:(id)rowItem withRowType:(CPRuleEditorRowType)type
|
||||
{
|
||||
if (rowItem == nil)
|
||||
{
|
||||
@@ -494,7 +494,7 @@
|
||||
return [[rowItem children] count];
|
||||
}
|
||||
|
||||
- (id)_queryChild:(int)childIndex ofItem:(id)rowItem withRowType:(int)type
|
||||
- (id)_queryChild:(int)childIndex ofItem:(id)rowItem withRowType:(CPRuleEditorRowType)type
|
||||
{
|
||||
if (rowItem == nil)
|
||||
{
|
||||
@@ -505,7 +505,7 @@
|
||||
return [[rowItem children] objectAtIndex:childIndex];
|
||||
}
|
||||
|
||||
- (id)_queryValueForItem:(id)rowItem inRow:(int)rowIndex
|
||||
- (id)_queryValueForItem:(id)rowItem inRow:(CPInteger)rowIndex
|
||||
{
|
||||
return [rowItem displayValue];
|
||||
}
|
||||
@@ -516,7 +516,7 @@ var CPPredicateTemplatesKey = @"CPPredicateTemplates";
|
||||
|
||||
@implementation CPPredicateEditor (CPCoding)
|
||||
|
||||
- (id)initWithCoder:(id)aCoder
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
|
||||
@@ -531,7 +531,7 @@ var CPPredicateTemplatesKey = @"CPPredicateTemplates";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(id)aCoder
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
[aCoder encodeObject:_allTemplates forKey:CPPredicateTemplatesKey];
|
||||
|
||||
@@ -702,12 +702,12 @@ CPTransformableAttributeType = 1800;
|
||||
return textField;
|
||||
}
|
||||
|
||||
- (void)_setOptions:(unsigned int)options
|
||||
- (void)_setOptions:(unsigned)options
|
||||
{
|
||||
_predicateOptions = options;
|
||||
}
|
||||
|
||||
- (void)_setModifier:(unsigned int)modifier
|
||||
- (void)_setModifier:(unsigned)modifier
|
||||
{
|
||||
_predicateModifier = modifier;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
||||
return @"rule-editor";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"alternating-row-colors": [CPNull null],
|
||||
@@ -461,7 +461,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
||||
@param row The index of a row in the receiver.
|
||||
@return The currently chosen items for row @a row.
|
||||
*/
|
||||
- (id)criteriaForRow:(int)row
|
||||
- (id)criteriaForRow:(CPInteger)row
|
||||
{
|
||||
var rowcache = [self _rowCacheForIndex:row];
|
||||
if (rowcache)
|
||||
@@ -480,7 +480,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
||||
@return The chosen values (strings, views, or menu items) for row row.
|
||||
@discussion The values returned are the same as those returned from the delegate method -#ruleEditor:displayValueForCriterion:inRow:
|
||||
*/
|
||||
- (CPMutableArray)displayValuesForRow:(int)row
|
||||
- (CPMutableArray)displayValuesForRow:(CPInteger)row
|
||||
{
|
||||
var rowcache = [self _rowCacheForIndex:row];
|
||||
if (rowcache)
|
||||
@@ -503,7 +503,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
||||
@param rowIndex The index of a row in the receiver.
|
||||
@return The index of the parent of the row at @a rowIndex. If the row at @a rowIndex is a root row, returns @c -1.
|
||||
*/
|
||||
- (int)parentRowForRow:(int)rowIndex
|
||||
- (int)parentRowForRow:(CPInteger)rowIndex
|
||||
{
|
||||
if (rowIndex < 0 || rowIndex >= [self numberOfRows])
|
||||
[CPException raise:CPRangeException reason:_cmd + @" row " + rowIndex + " is out of range"];
|
||||
@@ -544,7 +544,7 @@ TODO: implement
|
||||
@return The type of the row at @a rowIndex.
|
||||
@warning Raises a @c CPRangeException if rowIndex is less than @c 0 or greater than or equal to the number of rows.
|
||||
*/
|
||||
- (CPRuleEditorRowType)rowTypeForRow:(int)rowIndex
|
||||
- (CPRuleEditorRowType)rowTypeForRow:(CPInteger)rowIndex
|
||||
{
|
||||
if (rowIndex < 0 || rowIndex > [self numberOfRows])
|
||||
[CPException raise:CPRangeException reason:_cmd + @"row " + rowIndex + " is out of range"];
|
||||
@@ -565,7 +565,7 @@ TODO: implement
|
||||
@return The immediate subrows of the row at @a rowIndex.
|
||||
@discussion Rows are numbered starting at @c 0.
|
||||
*/
|
||||
- (CPIndexSet)subrowIndexesForRow:(int)rowIndex
|
||||
- (CPIndexSet)subrowIndexesForRow:(CPInteger)rowIndex
|
||||
{
|
||||
var object;
|
||||
|
||||
@@ -691,7 +691,7 @@ TODO: implement
|
||||
@note Currently, @a shouldAnimate has no effect, rows are always animated when calling this method.
|
||||
@see addRow:
|
||||
*/
|
||||
- (void)insertRowAtIndex:(int)rowIndex withType:(unsigned int)rowType asSubrowOfRow:(int)parentRow animate:(BOOL)shouldAnimate
|
||||
- (void)insertRowAtIndex:(int)rowIndex withType:(unsigned int)rowType asSubrowOfRow:(CPInteger)parentRow animate:(BOOL)shouldAnimate
|
||||
{
|
||||
/*
|
||||
TODO: raise exceptions if parentRow is greater than or equal to rowIndex, or if rowIndex would fall amongst the children of some other parent, or if the nesting mode forbids this configuration.
|
||||
@@ -1313,7 +1313,7 @@ TODO: implement
|
||||
return [_boundArrayOwner mutableArrayValueForKey:_boundArrayKeyPath];
|
||||
}
|
||||
|
||||
- (BOOL)_nextUnusedItems:(CPArray)items andValues:(CPArray)values forRow:(int)rowIndex forRowType:(unsigned int)type
|
||||
- (BOOL)_nextUnusedItems:(CPArray)items andValues:(CPArray)values forRow:(CPInteger)rowIndex forRowType:(unsigned int)type
|
||||
{
|
||||
var parentItem = [items lastObject], // if empty items array, this is NULL aka the root item;
|
||||
childrenCount = [self _queryNumberOfChildrenOfItem:parentItem withRowType:type],
|
||||
@@ -1375,7 +1375,7 @@ TODO: implement
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (CPMutableArray)_getItemsAndValuesToAddForRow:(int)rowIndex ofType:(CPRuleEditorRowType)type
|
||||
- (CPMutableArray)_getItemsAndValuesToAddForRow:(CPInteger)rowIndex ofType:(CPRuleEditorRowType)type
|
||||
{
|
||||
//var cachedItemsAndValues = _itemsAndValuesToAddForRowType[type];
|
||||
//if (cachedItemsAndValues)
|
||||
@@ -1418,7 +1418,7 @@ TODO: implement
|
||||
[self insertRowAtIndex:insertIndex withType:type asSubrowOfRow:parentRowIndex animate:YES];
|
||||
}
|
||||
|
||||
- (id)_insertNewRowAtIndex:(int)insertIndex ofType:(CPRuleEditorRowType)rowtype withParentRow:(int)parentRowIndex
|
||||
- (id)_insertNewRowAtIndex:(int)insertIndex ofType:(CPRuleEditorRowType)rowtype withParentRow:(CPInteger)parentRowIndex
|
||||
{
|
||||
var row = [[[self rowClass] alloc] init],
|
||||
itemsandvalues = [self _getItemsAndValuesToAddForRow:insertIndex ofType:rowtype],
|
||||
@@ -1520,7 +1520,7 @@ TODO: implement
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_changedItem:(id)fromItem toItem:(id)toItem inRow:(int)aRow atCriteriaIndex:(int)fromItemIndex
|
||||
- (void)_changedItem:(id)fromItem toItem:(id)toItem inRow:(CPInteger)aRow atCriteriaIndex:(int)fromItemIndex
|
||||
{
|
||||
var criteria = [self criteriaForRow:aRow],
|
||||
displayValues = [self displayValuesForRow:aRow],
|
||||
@@ -1684,7 +1684,7 @@ TODO: implement
|
||||
[super bind:aBinding toObject:observableController withKeyPath:aKeyPath options:options];
|
||||
}
|
||||
|
||||
- (void)unbind:(id)object
|
||||
- (void)unbind:(CPString)object
|
||||
{
|
||||
_rowClass = [_CPRuleEditorRowObject class];
|
||||
[super unbind:object];
|
||||
@@ -2005,7 +2005,7 @@ TODO: implement
|
||||
return [_ruleDelegate ruleEditor:self child:childIndex forCriterion:item withRowType:type];
|
||||
}
|
||||
|
||||
- (id)_queryValueForItem:(id)item inRow:(int)row
|
||||
- (id)_queryValueForItem:(id)item inRow:(CPInteger)row
|
||||
{
|
||||
return [_ruleDelegate ruleEditor:self displayValueForCriterion:item inRow:row];
|
||||
}
|
||||
@@ -2026,12 +2026,12 @@ TODO: implement
|
||||
_alignmentGridWidth = width;
|
||||
}
|
||||
|
||||
- (BOOL)_validateItem:(id)item value:(id)value inRow:(int)row
|
||||
- (BOOL)_validateItem:(id)item value:(id)value inRow:(CPInteger)row
|
||||
{
|
||||
return [self _queryCanSelectItem:item displayValue:value inRow:row];
|
||||
}
|
||||
|
||||
- (BOOL)_queryCanSelectItem:(id)item displayValue:(id)value inRow:(int)row
|
||||
- (BOOL)_queryCanSelectItem:(id)item displayValue:(id)value inRow:(CPInteger)row
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
@@ -2128,7 +2128,7 @@ TODO: implement
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (CPDragOperation)draggingEntered:(id < CPDraggingInfo >)sender
|
||||
- (CPDragOperation)draggingEntered:(id /*< CPDraggingInfo >*/)sender
|
||||
{
|
||||
if ([sender draggingSource] === self)
|
||||
{
|
||||
@@ -2158,7 +2158,7 @@ TODO: implement
|
||||
_subviewIndexOfDropLine = CPNotFound;
|
||||
}
|
||||
|
||||
- (CPDragOperation)draggingUpdated:(id <CPDraggingInfo>)sender
|
||||
- (CPDragOperation)draggingUpdated:(id /*<CPDraggingInfo>*/)sender
|
||||
{
|
||||
var point = [self convertPoint:[sender draggingLocation] fromView:nil],
|
||||
y = point.y + _sliceHeight / 2,
|
||||
@@ -2195,12 +2195,12 @@ TODO: implement
|
||||
return CPDragOperationMove;
|
||||
}
|
||||
|
||||
- (BOOL)prepareForDragOperation:(id < CPDraggingInfo >)sender
|
||||
- (BOOL)prepareForDragOperation:(id /*< CPDraggingInfo >*/)sender
|
||||
{
|
||||
return (_subviewIndexOfDropLine !== CPNotFound);
|
||||
}
|
||||
|
||||
- (BOOL)performDragOperation:(id < CPDraggingInfo >)info
|
||||
- (BOOL)performDragOperation:(id /*< CPDraggingInfo >*/)info
|
||||
{
|
||||
var aboveInsertIndexCount = 0,
|
||||
object,
|
||||
@@ -2262,7 +2262,7 @@ TODO: implement
|
||||
{
|
||||
}
|
||||
|
||||
- (void)_setWindow:(id)window
|
||||
- (void)_setWindow:(CPWindow)window
|
||||
{
|
||||
[super _setWindow:window];
|
||||
}
|
||||
@@ -2325,7 +2325,7 @@ TODO: implement
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)_getAllAvailableItems:(id)items values:(id)values asChildrenOfItem:(id)parentItem inRow:(int)aRow
|
||||
- (void)_getAllAvailableItems:(id)items values:(id)values asChildrenOfItem:(id)parentItem inRow:(CPInteger)aRow
|
||||
{
|
||||
var type,
|
||||
indexofCriterion,
|
||||
@@ -2426,7 +2426,7 @@ var CPRuleEditorAlignmentGridWidthKey = @"CPRuleEditorAlignmentGridWidth",
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(id)coder
|
||||
- (void)encodeWithCoder:(CPCoder)coder
|
||||
{
|
||||
[super encodeWithCoder:coder];
|
||||
|
||||
@@ -2481,7 +2481,7 @@ var CriteriaKey = @"criteria",
|
||||
return "<" + [self className] + ">\nsubrows = " + [subrows description] + "\ncriteria = " + [criteria description] + "\ndisplayValues = " + [displayValues description];
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(id)coder
|
||||
- (id)initWithCoder:(CPCoder)coder
|
||||
{
|
||||
self = [super init];
|
||||
if (self !== nil)
|
||||
@@ -2495,7 +2495,7 @@ var CriteriaKey = @"criteria",
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(id)coder
|
||||
- (void)encodeWithCoder:(CPCoder)coder
|
||||
{
|
||||
[coder encodeObject:subrows forKey:SubrowsKey];
|
||||
[coder encodeObject:criteria forKey:CriteriaKey];
|
||||
@@ -2534,7 +2534,7 @@ var CPBoundArrayKey = @"CPBoundArray";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(id)coder
|
||||
- (id)initWithCoder:(CPCoder)coder
|
||||
{
|
||||
if (self = [super init])
|
||||
boundArray = [coder decodeObjectForKey:CPBoundArrayKey];
|
||||
@@ -2542,7 +2542,7 @@ var CPBoundArrayKey = @"CPBoundArray";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(id)coder
|
||||
- (void)encodeWithCoder:(CPCoder)coder
|
||||
{
|
||||
[coder encodeObject:boundArray forKey:CPBoundArrayKey];
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ else if (CPBrowserIsEngine(CPInternetExplorerBrowserEngine))
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)hitTest:(CGPoint)point
|
||||
- (CPView)hitTest:(CGPoint)point
|
||||
{
|
||||
if (!CGRectContainsPoint([self frame], point) || ![self sliceIsEditable])
|
||||
return nil;
|
||||
@@ -100,12 +100,12 @@ else if (CPBrowserIsEngine(CPInternetExplorerBrowserEngine))
|
||||
return ![superview isKindOfClass:[_CPRuleEditorViewSlice]] || [superview isEditable];
|
||||
}
|
||||
|
||||
- (BOOL)trackMouse:(CPEvent)theEvent
|
||||
- (void)trackMouse:(CPEvent)theEvent
|
||||
{
|
||||
if (![self sliceIsEditable])
|
||||
return NO;
|
||||
return;
|
||||
|
||||
return [super trackMouse:theEvent];
|
||||
[super trackMouse:theEvent];
|
||||
}
|
||||
|
||||
- (CGRect)contentRectForBounds:(CGRect)bounds
|
||||
|
||||
@@ -522,7 +522,7 @@ var CONTROL_HEIGHT = 16.,
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)hitTest:(CGPoint)point
|
||||
- (CPView)hitTest:(CGPoint)point
|
||||
{
|
||||
if (!CGRectContainsPoint([self frame], point))
|
||||
return nil;
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
|
||||
return "scroller";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"scroller-width": 7.0,
|
||||
|
||||
@@ -458,7 +458,7 @@ var RECENT_SEARCH_PREFIX = @" ";
|
||||
[self sendAction:[self action] to:[self target]];
|
||||
}
|
||||
|
||||
- (void)sendAction:(SEL)anAction to:(id)anObject
|
||||
- (BOOL)sendAction:(SEL)anAction to:(id)anObject
|
||||
{
|
||||
[super sendAction:anAction to:anObject];
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
return "segmented-control";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"alignment": CPCenterTextAlignment,
|
||||
|
||||
@@ -47,7 +47,7 @@ CPThemeStateShadowViewHeavy = CPThemeState("shadowview-style-heavy");
|
||||
return "shadow-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"bezel-color": [CPNull null],
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ CPCircularSlider = 1;
|
||||
return "slider";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"knob-color": [CPNull null],
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
CPTextField _hexLabel;
|
||||
CPTextField _hexValue;
|
||||
|
||||
CPTextField _hexValue;
|
||||
CPTextField _redValue;
|
||||
CPTextField _greenValue;
|
||||
CPTextField _blueValue;
|
||||
|
||||
@@ -103,7 +103,7 @@ var ShouldSuppressResizeNotifications = 1,
|
||||
return @"splitview";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"divider-thickness": 1.0,
|
||||
@@ -995,7 +995,7 @@ The sum of the views and the sum of the dividers should be equal to the size of
|
||||
@param unsigned int - The divider index the button bar will be assigned to.
|
||||
*/
|
||||
// FIXME Should be renamed to setButtonBar:ofDividerAtIndex:.
|
||||
- (void)setButtonBar:(CPButtonBar)aButtonBar forDividerAtIndex:(unsigned)dividerIndex
|
||||
- (void)setButtonBar:(CPButtonBar)aButtonBar forDividerAtIndex:(CPUInteger)dividerIndex
|
||||
{
|
||||
if (!aButtonBar)
|
||||
{
|
||||
|
||||
+2
-2
@@ -213,7 +213,7 @@
|
||||
Set the current value of the stepper.
|
||||
@param aValue a float containing the value
|
||||
*/
|
||||
- (void)setDoubleValue:(float)aValue
|
||||
- (void)setDoubleValue:(double)aValue
|
||||
{
|
||||
if (aValue > _maxValue)
|
||||
[super setDoubleValue:_valueWraps ? _minValue : _maxValue];
|
||||
@@ -267,7 +267,7 @@
|
||||
return @"stepper";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"bezel-color-up-button": [CPNull null],
|
||||
|
||||
+3
-3
@@ -107,7 +107,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1,
|
||||
@param aTabViewItem the item to insert
|
||||
@param anIndex the index for the item
|
||||
*/
|
||||
- (void)insertTabViewItem:(CPTabViewItem)aTabViewItem atIndex:(unsigned)anIndex
|
||||
- (void)insertTabViewItem:(CPTabViewItem)aTabViewItem atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
[_items insertObject:aTabViewItem atIndex:anIndex];
|
||||
|
||||
@@ -183,7 +183,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1,
|
||||
Returns the CPTabViewItem at the specified index.
|
||||
@return a tab view item, or nil
|
||||
*/
|
||||
- (CPTabViewItem)tabViewItemAtIndex:(unsigned)anIndex
|
||||
- (CPTabViewItem)tabViewItemAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
return [_items objectAtIndex:anIndex];
|
||||
}
|
||||
@@ -270,7 +270,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1,
|
||||
Selects the item at the specified index.
|
||||
@param anIndex the index of the item to display.
|
||||
*/
|
||||
- (BOOL)selectTabViewItemAtIndex:(unsigned)anIndex
|
||||
- (BOOL)selectTabViewItemAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
if (anIndex === _selectedIndex)
|
||||
return;
|
||||
|
||||
@@ -416,7 +416,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
to be invoked with row equal to -1 in cases where no actual row is involved but the table
|
||||
view needs to get some generic cell info.
|
||||
*/
|
||||
- (id)dataViewForRow:(int)aRowIndex
|
||||
- (id)dataViewForRow:(CPInteger)aRowIndex
|
||||
{
|
||||
return [self dataView];
|
||||
}
|
||||
@@ -595,7 +595,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
|
||||
@implementation CPTableColumn (Bindings)
|
||||
|
||||
+ (id)_binderClassForBinding:(CPString)aBinding
|
||||
+ (Class)_binderClassForBinding:(CPString)aBinding
|
||||
{
|
||||
if (aBinding == CPValueBinding)
|
||||
return [CPTableColumnValueBinder class];
|
||||
@@ -828,7 +828,7 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey",
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (id)dataCellForRow:(int)row
|
||||
- (id)dataCellForRow:(CPInteger)row
|
||||
{
|
||||
[CPException raise:CPUnsupportedMethodException
|
||||
reason:@"dataCellForRow: is not supported. Use -dataViewForRow:row instead."];
|
||||
|
||||
+15
-15
@@ -43,7 +43,7 @@
|
||||
return @"columnHeader";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"background-color": [CPNull null],
|
||||
@@ -57,7 +57,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
- (void)initWithFrame:(CGRect)frame
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
|
||||
@@ -246,7 +246,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
return @"tableHeaderRow";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"background-color": [CPNull null],
|
||||
@@ -287,7 +287,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
return [_tableView columnAtPoint:CGPointMake(aPoint.x, aPoint.y)];
|
||||
}
|
||||
|
||||
- (CGRect)headerRectOfColumn:(int)aColumnIndex
|
||||
- (CGRect)headerRectOfColumn:(CPInteger)aColumnIndex
|
||||
{
|
||||
var headerRect = CGRectMakeCopy([self bounds]),
|
||||
columnRect = [_tableView rectOfColumn:aColumnIndex];
|
||||
@@ -308,7 +308,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
return _drawsColumnLines;
|
||||
}
|
||||
|
||||
- (CGRect)_cursorRectForColumn:(int)column
|
||||
- (CGRect)_cursorRectForColumn:(CPInteger)column
|
||||
{
|
||||
if (column == -1 || !([_tableView._tableColumns[column] resizingMask] & CPTableColumnUserResizingMask))
|
||||
return CGRectMakeZero();
|
||||
@@ -417,13 +417,13 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
[CPApp setTarget:self selector:@selector(trackMouse:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES];
|
||||
}
|
||||
|
||||
- (void)startTrackingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint
|
||||
- (void)startTrackingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint
|
||||
{
|
||||
_lastDragDestinationColumnIndex = -1;
|
||||
[self _setPressedColumn:aColumnIndex];
|
||||
}
|
||||
|
||||
- (BOOL)continueTrackingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint
|
||||
- (BOOL)continueTrackingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint
|
||||
{
|
||||
if ([self _shouldDragTableColumn:aColumnIndex at:aPoint])
|
||||
{
|
||||
@@ -444,19 +444,19 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)_shouldStopTrackingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint
|
||||
- (BOOL)_shouldStopTrackingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint
|
||||
{
|
||||
return _isTrackingColumn && _activeColumn === aColumnIndex &&
|
||||
CGRectContainsPoint([self headerRectOfColumn:aColumnIndex], aPoint);
|
||||
}
|
||||
|
||||
- (void)stopTrackingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint
|
||||
- (void)stopTrackingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint
|
||||
{
|
||||
[self _setPressedColumn:CPNotFound];
|
||||
[self _updateResizeCursor:[CPApp currentEvent]];
|
||||
}
|
||||
|
||||
- (BOOL)_shouldDragTableColumn:(int)aColumnIndex at:(CGPoint)aPoint
|
||||
- (BOOL)_shouldDragTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint
|
||||
{
|
||||
return ABS(aPoint.x - _mouseDownLocation.x) >= 10.0 && [_tableView _sendDelegateShouldReorderColumn:aColumnIndex toColumn:-1];
|
||||
}
|
||||
@@ -504,7 +504,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
[dragWindow setFrame:frame];
|
||||
}
|
||||
|
||||
- (void)_moveColumn:(int)aFromIndex toColumn:(int)aToIndex
|
||||
- (void)_moveColumn:(CPInteger)aFromIndex toColumn:(CPInteger)aToIndex
|
||||
{
|
||||
if ([_tableView _sendDelegateShouldReorderColumn:aFromIndex toColumn:aToIndex])
|
||||
{
|
||||
@@ -581,7 +581,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
[_tableView _enqueueDraggingViews];
|
||||
}
|
||||
|
||||
- (BOOL)shouldResizeTableColumn:(int)aColumnIndex at:(CGPoint)aPoint
|
||||
- (BOOL)shouldResizeTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint
|
||||
{
|
||||
if (_isResizing)
|
||||
return YES;
|
||||
@@ -592,7 +592,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
return [_tableView allowsColumnResizing] && CGRectContainsPoint([self _cursorRectForColumn:aColumnIndex], aPoint);
|
||||
}
|
||||
|
||||
- (void)startResizingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint
|
||||
- (void)startResizingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint
|
||||
{
|
||||
_isResizing = YES;
|
||||
|
||||
@@ -602,7 +602,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
[_tableView setDisableAutomaticResizing:YES];
|
||||
}
|
||||
|
||||
- (void)continueResizingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint
|
||||
- (void)continueResizingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint
|
||||
{
|
||||
var tableColumn = [[_tableView tableColumns] objectAtIndex:aColumnIndex],
|
||||
newWidth = [tableColumn width] + aPoint.x - _previousTrackingLocation.x;
|
||||
@@ -622,7 +622,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stopResizingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint
|
||||
- (void)stopResizingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint
|
||||
{
|
||||
var tableColumn = [[_tableView tableColumns] objectAtIndex:aColumnIndex];
|
||||
[tableColumn _postDidResizeNotificationWithOldWidth:_columnOldWidth];
|
||||
|
||||
+38
-38
@@ -453,14 +453,14 @@ Returns the number of rows in the tableview
|
||||
Returns the object value for each dataview. Each dataview will be sent a setObjectValue: method which will contain the object you return from this datasource method.
|
||||
@anchor objectValueForTable
|
||||
@code
|
||||
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRowIndex;
|
||||
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRowIndex;
|
||||
@endcode
|
||||
|
||||
|
||||
@section editing Editing:
|
||||
Sets the data object for an item in a given row and column. This needs to be implemented if you want inline editing support
|
||||
@code
|
||||
- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex;
|
||||
- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex;
|
||||
@endcode
|
||||
|
||||
|
||||
@@ -475,9 +475,9 @@ The tableview will call this method if you click the tableheader. You should sor
|
||||
@note In order for the tableview to receive drops don't forget to first register the tableview for drag types like you do with every other view.
|
||||
|
||||
Return the drag operation (move, copy, etc) that should be performed if a registered drag type is over the tableview
|
||||
The data source can retarget a drop if you want by calling <pre>-(void)setDropRow:(int)aRow dropOperation:(CPTableViewDropOperation)anOperation;</pre>
|
||||
The data source can retarget a drop if you want by calling <pre>-(void)setDropRow:(CPInteger)aRow dropOperation:(CPTableViewDropOperation)anOperation;</pre>
|
||||
@code
|
||||
- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(CPDraggingInfo)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)operation;
|
||||
- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(CPDraggingInfo)info proposedRow:(CPInteger)row proposedDropOperation:(CPTableViewDropOperation)operation;
|
||||
@endcode
|
||||
|
||||
Returns YES if the drop operation is allowed otherwise NO. This method is invoked by the tableview after a drag should begin, but before it is started. If you don't want the drag to being return NO. If you want the drag to begin you should return YES and place the drag data on the pboard.
|
||||
@@ -487,7 +487,7 @@ Returns YES if the drop operation is allowed otherwise NO. This method is invoke
|
||||
|
||||
Return YES if the operation was successful otherwise return NO. The data source should incorporate the data from the dragging pasteboard in this method implementation. To get this data use the draggingPasteboard method on the CPDraggingInfo object.
|
||||
@code
|
||||
- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(CPDraggingInfo)info row:(int)row dropOperation:(CPTableViewDropOperation)operation;
|
||||
- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(CPDraggingInfo)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)operation;
|
||||
@endcode
|
||||
|
||||
NOT YET IMPLEMENTED
|
||||
@@ -1128,7 +1128,7 @@ NOT YET IMPLEMENTED
|
||||
@param theColumnIndex The current index of the column to move.
|
||||
@param theToIndex The new index for the moved column.
|
||||
*/
|
||||
- (void)moveColumn:(int)theColumnIndex toColumn:(int)theToIndex
|
||||
- (void)moveColumn:(CPInteger)theColumnIndex toColumn:(CPInteger)theToIndex
|
||||
{
|
||||
[self _moveColumn:theColumnIndex toColumn:theToIndex];
|
||||
[self _autosave];
|
||||
@@ -2661,12 +2661,12 @@ The autoresizingMask of the returned view will automatically be set to CPViewNot
|
||||
|
||||
Called when the tableview is about to display a dataview
|
||||
@code
|
||||
- (void)tableView:(CPTableView)aTableView willDisplayView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex;
|
||||
- (void)tableView:(CPTableView)aTableView willDisplayView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex;
|
||||
@endcode
|
||||
|
||||
Group rows are a way to separate a groups of data in a tableview. Return YES if the given row is a group row, otherwise NO.
|
||||
@code
|
||||
- (BOOL)tableView:(CPTableView)tableView isGroupRow:(int)row;
|
||||
- (BOOL)tableView:(CPTableView)tableView isGroupRow:(CPInteger)row;
|
||||
@endcode
|
||||
|
||||
|
||||
@@ -2674,7 +2674,7 @@ Group rows are a way to separate a groups of data in a tableview. Return YES if
|
||||
|
||||
Return YES if the dataview at a given index and column should be edited, otherwise NO.
|
||||
@code
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex;
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex;
|
||||
@endcode
|
||||
|
||||
|
||||
@@ -2682,7 +2682,7 @@ Return YES if the dataview at a given index and column should be edited, otherwi
|
||||
|
||||
Return the height of the row at a given index. Only implement this if you want variable row heights. Otherwise use setRowHeight: on the tableview.
|
||||
@code
|
||||
- (float)tableView:(CPTableView)tableView heightOfRow:(int)row;
|
||||
- (float)tableView:(CPTableView)tableView heightOfRow:(CPInteger)row;
|
||||
@endcode
|
||||
|
||||
|
||||
@@ -2696,7 +2696,7 @@ Return YES if the selection of the tableview should change, otherwise NO to keep
|
||||
|
||||
Return YES if the row at a given index should be selected, other NO to deny the selection.
|
||||
@code
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(int)rowIndex;
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(CPInteger)rowIndex;
|
||||
@endcode
|
||||
|
||||
Return YES if the table column given should be selected, otherwise NO to deny the selection.
|
||||
@@ -2722,7 +2722,7 @@ Return YES if the column at a given index should move to a new column index, oth
|
||||
When a column is initially dragged by the user, the delegate is first called with a newColumnIndex value of -1
|
||||
|
||||
@code
|
||||
- (BOOL)tableView:(CPTableView)tableView shouldReorderColumn:(int)columnIndex toColumn:(int)newColumnIndex;
|
||||
- (BOOL)tableView:(CPTableView)tableView shouldReorderColumn:(CPInteger)columnIndex toColumn:(CPInteger)newColumnIndex;
|
||||
@endcode
|
||||
|
||||
|
||||
@@ -2762,7 +2762,7 @@ Notify the delegate that the user has clicked the table header of a column.
|
||||
Called when the user right-clicks on the tableview. -1 is passed for the row or column if the user doesn't right click on a real row or column
|
||||
Return a CPMenu that should be displayed if the user right-clicks. If you do not implement this the tableview will call super on menuForEvent
|
||||
@code
|
||||
- (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aColumn row:(int)aRow;
|
||||
- (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow;
|
||||
@endcode
|
||||
|
||||
|
||||
@@ -2918,7 +2918,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)_didClickTableColumn:(int)clickedColumn modifierFlags:(unsigned)modifierFlags
|
||||
- (void)_didClickTableColumn:(CPInteger)clickedColumn modifierFlags:(unsigned)modifierFlags
|
||||
{
|
||||
[self _changeSortDescriptorsForClickOnColumn:clickedColumn];
|
||||
|
||||
@@ -2959,7 +2959,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)_changeSortDescriptorsForClickOnColumn:(int)column
|
||||
- (void)_changeSortDescriptorsForClickOnColumn:(CPInteger)column
|
||||
{
|
||||
var tableColumn = [_tableColumns objectAtIndex:column],
|
||||
newMainSortDescriptor = [tableColumn sortDescriptorPrototype];
|
||||
@@ -3139,7 +3139,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
// Copy the dataviews add them to a transparent drag view and use that drag view
|
||||
// to make it appear we are dragging images of those rows (as you would do in regular Cocoa)
|
||||
*/
|
||||
- (CPView)_dragViewForColumn:(int)theColumnIndex event:(CPEvent)theDragEvent offset:(CGPoint)theDragViewOffset
|
||||
- (CPView)_dragViewForColumn:(CPInteger)theColumnIndex event:(CPEvent)theDragEvent offset:(CGPoint)theDragViewOffset
|
||||
{
|
||||
var dragView = [[_CPColumnDragView alloc] initWithLineColor:[self gridColor]],
|
||||
tableColumn = [[self tableColumns] objectAtIndex:theColumnIndex],
|
||||
@@ -4767,7 +4767,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (CGRect)_rectForDropHighlightViewOnRow:(int)theRowIndex
|
||||
- (CGRect)_rectForDropHighlightViewOnRow:(CPInteger)theRowIndex
|
||||
{
|
||||
if (theRowIndex >= [self numberOfRows])
|
||||
theRowIndex = [self numberOfRows] - 1;
|
||||
@@ -4778,7 +4778,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (CGRect)_rectForDropHighlightViewBetweenUpperRow:(int)theUpperRowIndex andLowerRow:(int)theLowerRowIndex offset:(CGPoint)theOffset
|
||||
- (CGRect)_rectForDropHighlightViewBetweenUpperRow:(CPInteger)theUpperRowIndex andLowerRow:(CPInteger)theLowerRowIndex offset:(CGPoint)theOffset
|
||||
{
|
||||
if (theLowerRowIndex > [self numberOfRows])
|
||||
theLowerRowIndex = [self numberOfRows];
|
||||
@@ -5338,7 +5338,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
Return the objectValue for the given column and row.
|
||||
By default return nil.
|
||||
*/
|
||||
- (id)_sendDataSourceObjectValueForTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex
|
||||
- (id)_sendDataSourceObjectValueForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
|
||||
{
|
||||
if (!(_implementedDataSourceMethods & CPTableViewDataSource_tableView_objectValueForTableColumn_row_))
|
||||
return nil;
|
||||
@@ -5350,7 +5350,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Call the method tableView:setObjectValue:ForTableColum:row: of the dataSource
|
||||
*/
|
||||
- (void)_sendDataSourceSetObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex
|
||||
- (void)_sendDataSourceSetObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
|
||||
{
|
||||
if (!(_implementedDataSourceMethods & CPTableViewDataSource_tableView_setObjectValue_forTableColumn_row_))
|
||||
return;
|
||||
@@ -5374,7 +5374,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Return if the drop is accepted or not for the given dropOperation, info and row. By default return NO.
|
||||
*/
|
||||
- (BOOL)_sendDataSourceAcceptDrop:(id)info row:(int)aRowIndex dropOperation:(CPTableViewDropOperation)operation
|
||||
- (BOOL)_sendDataSourceAcceptDrop:(id)info row:(CPInteger)aRowIndex dropOperation:(CPTableViewDropOperation)operation
|
||||
{
|
||||
if (!(_implementedDataSourceMethods & CPTableViewDataSource_tableView_acceptDrop_row_dropOperation_))
|
||||
return NO;
|
||||
@@ -5386,7 +5386,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Return the dragOperation for the given row and dropOperation. By default return CPDragOperationNone.
|
||||
*/
|
||||
- (CPDragOperation)_sendDataSourceValidateDrop:(id)info proposedRow:(int)aRowIndex proposedDropOperation:(CPTableViewDropOperation)operation
|
||||
- (CPDragOperation)_sendDataSourceValidateDrop:(id)info proposedRow:(CPInteger)aRowIndex proposedDropOperation:(CPTableViewDropOperation)operation
|
||||
{
|
||||
if (!(_implementedDataSourceMethods & CPTableViewDataSource_tableView_validateDrop_proposedRow_proposedDropOperation_))
|
||||
return CPDragOperationNone;
|
||||
@@ -5494,7 +5494,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Call the delegate didClickTableColumn with the given tableColumn
|
||||
*/
|
||||
- (void)_sendDelegateDidClickTableColumn:(int)column
|
||||
- (void)_sendDelegateDidClickTableColumn:(CPInteger)column
|
||||
{
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_didClickTableColumn_)
|
||||
[_delegate tableView:self didClickTableColumn:_tableColumns[column]];
|
||||
@@ -5504,7 +5504,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Call the delegate didDragTableColumn with the given tableColumn
|
||||
*/
|
||||
- (void)_sendDelegateDidDragTableColumn:(int)column
|
||||
- (void)_sendDelegateDidDragTableColumn:(CPInteger)column
|
||||
{
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_didDragTableColumn_)
|
||||
[_delegate tableView:self didDragTableColumn:_tableColumns[column]];
|
||||
@@ -5514,7 +5514,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Call the delegate mouseDownInHeaderOfTableColumn with the given tableColumn
|
||||
*/
|
||||
- (void)_sendDelegateMouseDownInHeaderOfTableColumn:(int)column
|
||||
- (void)_sendDelegateMouseDownInHeaderOfTableColumn:(CPInteger)column
|
||||
{
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_mouseDownInHeaderOfTableColumn_)
|
||||
[_delegate tableView:self mouseDownInHeaderOfTableColumn:_tableColumns[column]];
|
||||
@@ -5551,7 +5551,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Return if the given row is a group or not. By default return NO.
|
||||
*/
|
||||
- (BOOL)_sendDelegateIsGroupRow:(int)anIndex
|
||||
- (BOOL)_sendDelegateIsGroupRow:(CPInteger)anIndex
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_isGroupRow_))
|
||||
return NO;
|
||||
@@ -5563,7 +5563,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Return is we should select the given row. By Default return YES
|
||||
*/
|
||||
- (BOOL)_sendDelegateShouldSelectRow:(int)anIndex
|
||||
- (BOOL)_sendDelegateShouldSelectRow:(CPInteger)anIndex
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldSelectRow_))
|
||||
return YES;
|
||||
@@ -5575,7 +5575,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Call the delegate tableView:willDisplayView:forTableColumn:row:
|
||||
*/
|
||||
- (void)_sendDelegateWillDisplayView:(id)aCell forTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex
|
||||
- (void)_sendDelegateWillDisplayView:(id)aCell forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_willDisplayView_forTableColumn_row_))
|
||||
return;
|
||||
@@ -5601,7 +5601,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
It can be possible if column reordering is allowed and if the tableview
|
||||
delegate also accept the reordering
|
||||
*/
|
||||
- (BOOL)_sendDelegateShouldReorderColumn:(int)columnIndex toColumn:(int)newColumnIndex
|
||||
- (BOOL)_sendDelegateShouldReorderColumn:(CPInteger)columnIndex toColumn:(CPInteger)newColumnIndex
|
||||
{
|
||||
if ([self allowsColumnReordering] &&
|
||||
_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldReorderColumn_toColumn_)
|
||||
@@ -5616,7 +5616,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Return the height of the given row. By default return [self rowHeight].
|
||||
*/
|
||||
- (float)_sendDelegateHeightOfRow:(int)anIndex
|
||||
- (float)_sendDelegateHeightOfRow:(CPInteger)anIndex
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_))
|
||||
return [self rowHeight];
|
||||
@@ -5628,7 +5628,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Return a boolean to know if we should or not edit the given row. By default return YES.
|
||||
*/
|
||||
- (BOOL)_sendDelegateShouldEditTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex
|
||||
- (BOOL)_sendDelegateShouldEditTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldEditTableColumn_row_))
|
||||
return YES;
|
||||
@@ -5652,7 +5652,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Return a view for the given tableColumn and row. By default return nil.
|
||||
*/
|
||||
- (CPView)_sendDelegateViewForTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex
|
||||
- (CPView)_sendDelegateViewForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_viewForTableColumn_row_))
|
||||
return nil;
|
||||
@@ -5664,7 +5664,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Return a view for the given tableColumn and row. By default return nil.
|
||||
*/
|
||||
- (CPView)_sendDelegateDataViewForTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex
|
||||
- (CPView)_sendDelegateDataViewForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_dataViewForTableColumn_row_))
|
||||
return nil;
|
||||
@@ -5692,7 +5692,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Not yet implemented
|
||||
*/
|
||||
- (CPString)_sendDelegateToolTipForView:(id)aView rect:(CGRect)aRect tableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex mouseLocation:(CGPoint)aPoint
|
||||
- (CPString)_sendDelegateToolTipForView:(id)aView rect:(CGRect)aRect tableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex mouseLocation:(CGPoint)aPoint
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_toolTipForView_rect_tableColumn_row_mouseLocation_))
|
||||
return nil;
|
||||
@@ -5704,7 +5704,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Not yet implemented
|
||||
*/
|
||||
- (BOOL)_sendDelegateShouldTrackView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex
|
||||
- (BOOL)_sendDelegateShouldTrackView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldTrackView_forTableColumn_row_))
|
||||
return YES;
|
||||
@@ -5716,7 +5716,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Not yet implemented
|
||||
*/
|
||||
- (BOOL)_sendDelegateShouldShowViewExpansionForTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex
|
||||
- (BOOL)_sendDelegateShouldShowViewExpansionForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldShowViewExpansionForTableColumn_row_))
|
||||
return YES;
|
||||
@@ -5740,7 +5740,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Not yet implemented
|
||||
*/
|
||||
- (CPString)_sendDelegateTypeSelectStringForTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex
|
||||
- (CPString)_sendDelegateTypeSelectStringForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_typeSelectStringForTableColumn_row_))
|
||||
return nil;
|
||||
@@ -5752,7 +5752,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
@ignore
|
||||
Not yet implemented !
|
||||
*/
|
||||
- (int)_sendDelegateNextTypeSelectMatchFromRow:(int)aRowIndex toRow:(int)aSecondRowIndex forString:(CPString)aString
|
||||
- (int)_sendDelegateNextTypeSelectMatchFromRow:(CPInteger)aRowIndex toRow:(CPInteger)aSecondRowIndex forString:(CPString)aString
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_nextTypeSelectMatchFromRow_toRow_forString_))
|
||||
return -1;
|
||||
|
||||
@@ -209,7 +209,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
return "textfield";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"bezel-inset": CGInsetMakeZero(),
|
||||
@@ -1765,7 +1765,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
[self _becomeFirstKeyResponder];
|
||||
}
|
||||
|
||||
- (BOOL)validateUserInterfaceItem:(id <CPValidatedUserInterfaceItem>)anItem
|
||||
- (BOOL)validateUserInterfaceItem:(id /*<CPValidatedUserInterfaceItem>*/)anItem
|
||||
{
|
||||
var theAction = [anItem action];
|
||||
|
||||
@@ -1883,7 +1883,7 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
|
||||
|
||||
@implementation _CPTextFieldValueBinder : CPBinder
|
||||
|
||||
- (void)_updatePlaceholdersWithOptions:(CPDictionary)options forBinding:(CPBinder)aBinding
|
||||
- (void)_updatePlaceholdersWithOptions:(CPDictionary)options forBinding:(CPString)aBinding
|
||||
{
|
||||
[super _updatePlaceholdersWithOptions:options];
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
return "tokenfield";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{ @"editor-inset": CGInsetMakeZero() };
|
||||
}
|
||||
@@ -645,7 +645,7 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
[[self _tokens] makeObjectsPerformSelector:@selector(setEditable:) withObject:shouldBeEditable];
|
||||
}
|
||||
|
||||
- (void)sendAction:(SEL)anAction to:(id)anObject
|
||||
- (BOOL)sendAction:(SEL)anAction to:(id)anObject
|
||||
{
|
||||
_shouldNotifyTarget = NO;
|
||||
[super sendAction:anAction to:anObject];
|
||||
@@ -653,7 +653,7 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
|
||||
// Incredible hack to disable supers implementation
|
||||
// so it cannot change our object value and break the tokenfield
|
||||
- (void)_setStringValue:(id)aValue
|
||||
- (BOOL)_setStringValue:(CPString)aValue
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1541,7 +1541,7 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
{
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
var attributes = [CPButton themeAttributes];
|
||||
|
||||
@@ -1571,7 +1571,7 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
{
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
var attributes = [CPButton themeAttributes];
|
||||
|
||||
|
||||
+3
-3
@@ -93,7 +93,7 @@ var CPToolbarsByIdentifier = nil,
|
||||
BOOL _showsBaselineSeparator;
|
||||
BOOL _allowsUserCustomization;
|
||||
BOOL _isVisible;
|
||||
int _sizeMode @accessors(property=sizeMode);
|
||||
CPToolbarSizeMode _sizeMode @accessors(property=sizeMode);
|
||||
int _desiredHeight;
|
||||
|
||||
id _delegate;
|
||||
@@ -594,7 +594,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth)
|
||||
return @"toolbar-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"item-margin": 10.0,
|
||||
@@ -1216,7 +1216,7 @@ var LABEL_MARGIN = 2.0;
|
||||
[_labelField setTextShadowColor:[self FIXME_labelShadowColor]];
|
||||
}
|
||||
|
||||
- (void)sendAction:(SEL)anAction to:(id)aSender
|
||||
- (BOOL)sendAction:(SEL)anAction to:(id)aSender
|
||||
{
|
||||
[CPApp sendAction:anAction to:aSender from:_toolbarItem];
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ CPViewAnimationFadeOutEffect = @"CPViewAnimationFadeOutEffect";
|
||||
[super startAnimation];
|
||||
}
|
||||
|
||||
- (void)setCurrentProgress:(CPAnimationProgress)progress
|
||||
- (void)setCurrentProgress:(float)progress
|
||||
{
|
||||
[super setCurrentProgress:progress];
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ CPTexturedBackgroundWindowMask
|
||||
@param aStyleMask a style mask
|
||||
@return the initialized window
|
||||
*/
|
||||
- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned int)aStyleMask
|
||||
- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned)aStyleMask
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
return @"bordeless-bridge-window-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"toolbar-background-color": [CPColor grayColor],
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
return @"doc-modal-window-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"body-color": [CPColor whiteColor],
|
||||
|
||||
@@ -50,7 +50,7 @@ var _CPPopoverWindowViewDefaultCursorSize = CGSizeMake(16, 10);
|
||||
return @"popover-window-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"background-gradient": [CPNull null],
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
return @"shadow-window-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{};
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ var _CPStandardWindowViewDividerViewHeight = 1.0;
|
||||
return @"textured-window-head-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{};
|
||||
}
|
||||
@@ -108,7 +108,7 @@ var _CPStandardWindowViewDividerViewHeight = 1.0;
|
||||
return @"standard-window-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"gradient-height": [CPNull null],
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
return @"tooltip";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"stroke-color": [CPColor colorWithHexString:@"E3E3E3"],
|
||||
|
||||
@@ -81,7 +81,7 @@ _CPWindowViewResizeSlop = 3;
|
||||
return "window";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"title-bar-height": 25,
|
||||
|
||||
@@ -687,7 +687,7 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
|
||||
@param aLayer the layer to insert
|
||||
@param anIndex the index to insert the layer at
|
||||
*/
|
||||
- (void)insertSublayer:(CALayer)aLayer atIndex:(unsigned)anIndex
|
||||
- (void)insertSublayer:(CALayer)aLayer atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
if (!aLayer)
|
||||
return;
|
||||
|
||||
@@ -75,7 +75,7 @@ var CAMediaNamedTimingFunctions = nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)getControlPointAtIndex:(unsigned)anIndex values:(float/*[2]*/)reference
|
||||
- (void)getControlPointAtIndex:(CPUInteger)anIndex values:(float/*[2]*/)reference
|
||||
{
|
||||
if (anIndex == 0)
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
aWindow._isVisible = NO;
|
||||
}
|
||||
|
||||
- (void)insertWindow:(CPWindow)aWindow atIndex:(unsigned)anIndex
|
||||
- (void)insertWindow:(CPWindow)aWindow atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
// We will have to adjust the z-index of all windows starting at this index.
|
||||
var count = [_windows count],
|
||||
|
||||
@@ -268,7 +268,7 @@ var _CPAutocompleteMenuMaximumHeight = 307;
|
||||
return [contentArray count];
|
||||
}
|
||||
|
||||
- (void)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(int)row
|
||||
- (void)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row
|
||||
{
|
||||
return [contentArray objectAtIndex:row];
|
||||
}
|
||||
@@ -282,7 +282,7 @@ var _CPAutocompleteMenuMaximumHeight = 307;
|
||||
|
||||
@implementation _CPAutocompleteWindow : CPPanel
|
||||
|
||||
- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned int)aStyleMask
|
||||
- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned)aStyleMask
|
||||
{
|
||||
if (self = [super initWithContentRect:aContentRect styleMask:aStyleMask])
|
||||
_constrainsToUsableScreen = NO;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
return @"cornerview";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"background-color": [CPNull null],
|
||||
|
||||
@@ -220,7 +220,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)imageScaling
|
||||
- (CPUInteger)imageScaling
|
||||
{
|
||||
return _imageScaling;
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ var ListColumnIdentifier = @"1";
|
||||
/*!
|
||||
Selects a row and scrolls it to be visible. Returns YES if the selection actually changed.
|
||||
*/
|
||||
- (BOOL)selectRow:(int)row
|
||||
- (BOOL)selectRow:(CPInteger)row
|
||||
{
|
||||
if (row === [_tableView selectedRow])
|
||||
return NO;
|
||||
@@ -794,7 +794,7 @@ var _CPPopUpListDataSourceKey = @"_CPPopUpListDataSourceKey",
|
||||
return MAX([_dataSource numberOfItemsInList:self], 1);
|
||||
}
|
||||
|
||||
- (id)tableView:(id)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow
|
||||
- (id)tableView:(id)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow
|
||||
{
|
||||
return [_dataSource list:self displayValueForObjectValue:[_dataSource list:self objectValueForItemAtIndex:aRow]];
|
||||
}
|
||||
@@ -853,7 +853,7 @@ var _CPPopUpListDataSourceKey = @"_CPPopUpListDataSourceKey",
|
||||
|
||||
@implementation _CPPopUpPanel : CPPanel
|
||||
|
||||
- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned int)aStyleMask
|
||||
- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned)aStyleMask
|
||||
{
|
||||
if (self = [super initWithContentRect:aContentRect styleMask:aStyleMask])
|
||||
_constrainsToUsableScreen = NO;
|
||||
|
||||
@@ -399,7 +399,7 @@ var _CPPopoverWindow_shouldClose_ = 1 << 0,
|
||||
|
||||
@param sender the sender of the action
|
||||
*/
|
||||
- (IBAction)orderFront:(is)aSender
|
||||
- (IBAction)orderFront:(id)aSender
|
||||
{
|
||||
if (![self isKeyWindow])
|
||||
{
|
||||
|
||||
+1
-1
@@ -598,7 +598,7 @@ Use descriptive parameter types, despite not being fully supported in JavaScript
|
||||
|
||||
##### Right:
|
||||
|
||||
- (char)characterAtIndex:(unsigned)anIndex;
|
||||
- (char)characterAtIndex:(CPUInteger)anIndex;
|
||||
- (void)insertObject:(id)anObject;
|
||||
|
||||
##### Wrong:
|
||||
|
||||
+10
-10
@@ -197,7 +197,7 @@
|
||||
[_proxyObject setValue:anObject forKey:_key];
|
||||
}
|
||||
|
||||
- (unsigned)count
|
||||
- (CPUInteger)count
|
||||
{
|
||||
if (_count)
|
||||
return _count(_proxyObject, _countSEL);
|
||||
@@ -205,7 +205,7 @@
|
||||
return [[self _representedObject] count];
|
||||
}
|
||||
|
||||
- (int)indexOfObject:(CPObject)anObject inRange:(CPRange)aRange
|
||||
- (CPUInteger)indexOfObject:(id)anObject inRange:(CPRange)aRange
|
||||
{
|
||||
var index = aRange.location,
|
||||
count = aRange.length,
|
||||
@@ -222,12 +222,12 @@
|
||||
return CPNotFound;
|
||||
}
|
||||
|
||||
- (int)indexOfObject:(CPObject)anObject
|
||||
- (CPUInteger)indexOfObject:(id)anObject
|
||||
{
|
||||
return [self indexOfObject:anObject inRange:CPMakeRange(0, [self count])];
|
||||
}
|
||||
|
||||
- (int)indexOfObjectIdenticalTo:(CPObject)anObject inRange:(CPRange)aRange
|
||||
- (CPUInteger)indexOfObjectIdenticalTo:(id)anObject inRange:(CPRange)aRange
|
||||
{
|
||||
var index = aRange.location,
|
||||
count = aRange.length;
|
||||
@@ -239,12 +239,12 @@
|
||||
return CPNotFound;
|
||||
}
|
||||
|
||||
- (int)indexOfObjectIdenticalTo:(CPObject)anObject
|
||||
- (CPUInteger)indexOfObjectIdenticalTo:(id)anObject
|
||||
{
|
||||
return [self indexOfObjectIdenticalTo:anObject inRange:CPMakeRange(0, [self count])];
|
||||
}
|
||||
|
||||
- (id)objectAtIndex:(unsigned)anIndex
|
||||
- (id)objectAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
return [[self objectsAtIndexes:[CPIndexSet indexSetWithIndex:anIndex]] firstObject];
|
||||
}
|
||||
@@ -281,7 +281,7 @@
|
||||
[self insertObjects:anArray atIndexes:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange([self count], count)]];
|
||||
}
|
||||
|
||||
- (void)insertObject:(id)anObject atIndex:(unsigned)anIndex
|
||||
- (void)insertObject:(id)anObject atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
[self insertObjects:[anObject] atIndexes:[CPIndexSet indexSetWithIndex:anIndex]];
|
||||
}
|
||||
@@ -378,7 +378,7 @@
|
||||
[self removeObjectsAtIndexes:[CPIndexSet indexSetWithIndex:[self count] - 1]];
|
||||
}
|
||||
|
||||
- (void)removeObjectAtIndex:(unsigned)anIndex
|
||||
- (void)removeObjectAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
[self removeObjectsAtIndexes:[CPIndexSet indexSetWithIndex:anIndex]];
|
||||
}
|
||||
@@ -405,7 +405,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)replaceObjectAtIndex:(unsigned)anIndex withObject:(id)anObject
|
||||
- (void)replaceObjectAtIndex:(CPUInteger)anIndex withObject:(id)anObject
|
||||
{
|
||||
[self replaceObjectsAtIndexes:[CPIndexSet indexSetWithIndex:anIndex] withObjects:[anObject]]
|
||||
}
|
||||
@@ -564,7 +564,7 @@
|
||||
/*!
|
||||
Registers an observer to receive key value observer notifications for the specified key-path relative to the objects at the indexes.
|
||||
*/
|
||||
- (void)addObserver:(id)anObserver toObjectsAtIndexes:(CPIndexSet)indexes forKeyPath:(CPString)aKeyPath options:(unsigned)options context:(id)context
|
||||
- (void)addObserver:(id)anObserver toObjectsAtIndexes:(CPIndexSet)indexes forKeyPath:(CPString)aKeyPath options:(CPKeyValueObservingOptions)options context:(id)context
|
||||
{
|
||||
var index = [indexes firstIndex];
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
items. Because CPArray is backed by JavaScript arrays,
|
||||
this method ends up simply returning a regular array.
|
||||
*/
|
||||
+ (CPArray)arrayWithCapacity:(unsigned)aCapacity
|
||||
+ (CPArray)arrayWithCapacity:(CPUInteger)aCapacity
|
||||
{
|
||||
return [[self alloc] initWithCapacity:aCapacity];
|
||||
}
|
||||
@@ -30,7 +30,7 @@
|
||||
Initializes an array able to store at least \c aCapacity items. Because CPArray
|
||||
is backed by JavaScript arrays, this method ends up simply returning a regular array.
|
||||
*/
|
||||
/*- (id)initWithCapacity:(unsigned)aCapacity
|
||||
/*- (id)initWithCapacity:(CPUInteger)aCapacity
|
||||
{
|
||||
return self;
|
||||
}*/
|
||||
@@ -63,7 +63,7 @@
|
||||
@param anObject the object to insert into the array
|
||||
@param anIndex the location to insert \c anObject at
|
||||
*/
|
||||
- (void)insertObject:(id)anObject atIndex:(int)anIndex
|
||||
- (void)insertObject:(id)anObject atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
}
|
||||
@@ -93,7 +93,7 @@
|
||||
[self insertObject:[objects objectAtIndex:index] atIndex:currentIndex];
|
||||
}
|
||||
|
||||
- (unsigned)insertObject:(id)anObject inArraySortedByDescriptors:(CPArray)descriptors
|
||||
- (CPUInteger)insertObject:(id)anObject inArraySortedByDescriptors:(CPArray)descriptors
|
||||
{
|
||||
var index,
|
||||
count = [descriptors count];
|
||||
@@ -126,7 +126,7 @@
|
||||
The current element at position \c anIndex will be removed from the array.
|
||||
@param anIndex the position in the array to place \c anObject
|
||||
*/
|
||||
- (void)replaceObjectAtIndex:(int)anIndex withObject:(id)anObject
|
||||
- (void)replaceObjectAtIndex:(CPUInteger)anIndex withObject:(id)anObject
|
||||
{
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
}
|
||||
@@ -241,7 +241,7 @@
|
||||
Removes the object at \c anIndex.
|
||||
@param anIndex the location of the element to be removed
|
||||
*/
|
||||
- (void)removeObjectAtIndex:(int)anIndex
|
||||
- (void)removeObjectAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
}
|
||||
@@ -322,7 +322,7 @@
|
||||
@param anIndex the first index to swap from
|
||||
@param otherIndex the second index to swap from
|
||||
*/
|
||||
- (void)exchangeObjectAtIndex:(unsigned)anIndex withObjectAtIndex:(unsigned)otherIndex
|
||||
- (void)exchangeObjectAtIndex:(CPUInteger)anIndex withObjectAtIndex:(CPUInteger)otherIndex
|
||||
{
|
||||
if (anIndex === otherIndex)
|
||||
return;
|
||||
|
||||
@@ -122,7 +122,7 @@ var concat = Array.prototype.concat,
|
||||
@param aCount the number of objects in the JS Array
|
||||
@return a new CPArray containing the specified objects
|
||||
*/
|
||||
+ (id)arrayWithObjects:(id)objects count:(unsigned)aCount
|
||||
+ (id)arrayWithObjects:(id)objects count:(CPUInteger)aCount
|
||||
{
|
||||
return [[self alloc] initWithObjects:objects count:aCount];
|
||||
}
|
||||
@@ -174,13 +174,13 @@ var concat = Array.prototype.concat,
|
||||
@param aCount the number of objects in \c objects
|
||||
@return the initialized CPArray
|
||||
*/
|
||||
- (id)initWithObjects:(id)objects count:(unsigned)aCount
|
||||
- (id)initWithObjects:(CPArray)objects count:(CPUInteger)aCount
|
||||
{
|
||||
FORWARD_TO_CONCRETE_CLASS();
|
||||
}
|
||||
|
||||
// FIXME: This should be defined in CPMutableArray, not here.
|
||||
- (id)initWithCapacity:(unsigned)aCapacity
|
||||
- (id)initWithCapacity:(CPUInteger)aCapacity
|
||||
{
|
||||
FORWARD_TO_CONCRETE_CLASS();
|
||||
}
|
||||
@@ -203,7 +203,7 @@ var concat = Array.prototype.concat,
|
||||
/*!
|
||||
Returns the number of elements in the array
|
||||
*/
|
||||
- (int)count
|
||||
- (CPUInteger)count
|
||||
{
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
}
|
||||
@@ -238,7 +238,7 @@ var concat = Array.prototype.concat,
|
||||
Returns the object at index \c anIndex.
|
||||
@throws CPRangeException if \c anIndex is out of bounds
|
||||
*/
|
||||
- (id)objectAtIndex:(int)anIndex
|
||||
- (id)objectAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ var concat = Array.prototype.concat,
|
||||
return [];
|
||||
}
|
||||
|
||||
+ (CPArray)array
|
||||
+ (id)array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@@ -107,7 +107,7 @@ var concat = Array.prototype.concat,
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)count
|
||||
- (CPUInteger)count
|
||||
{
|
||||
return self.length;
|
||||
}
|
||||
@@ -230,7 +230,7 @@ var concat = Array.prototype.concat,
|
||||
return join.call(self, aString);
|
||||
}
|
||||
|
||||
- (void)insertObject:(id)anObject atIndex:(int)anIndex
|
||||
- (void)insertObject:(id)anObject atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
if (anIndex > self.length || anIndex < 0)
|
||||
_CPRaiseRangeException(self, _cmd, anIndex, self.length);
|
||||
@@ -238,7 +238,7 @@ var concat = Array.prototype.concat,
|
||||
splice.call(self, anIndex, 0, anObject);
|
||||
}
|
||||
|
||||
- (void)removeObjectAtIndex:(int)anIndex
|
||||
- (void)removeObjectAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
if (anIndex >= self.length || anIndex < 0)
|
||||
_CPRaiseRangeException(self, _cmd, anIndex, self.length);
|
||||
@@ -289,7 +289,7 @@ var concat = Array.prototype.concat,
|
||||
splice.call(self, aRange.location, aRange.length);
|
||||
}
|
||||
|
||||
- (void)replaceObjectAtIndex:(int)anIndex withObject:(id)anObject
|
||||
- (void)replaceObjectAtIndex:(CPUInteger)anIndex withObject:(id)anObject
|
||||
{
|
||||
if (anIndex >= self.length || anIndex < 0)
|
||||
_CPRaiseRangeException(self, _cmd, anIndex, self.length);
|
||||
@@ -333,7 +333,7 @@ var concat = Array.prototype.concat,
|
||||
}
|
||||
|
||||
|
||||
- (void)copy
|
||||
- (id)copy
|
||||
{
|
||||
return slice.call(self, 0);
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
character at index \c anIndex. Returns an empty dictionary if index
|
||||
is out of bounds.
|
||||
*/
|
||||
- (CPDictionary)attributesAtIndex:(unsigned)anIndex effectiveRange:(CPRangePointer)aRange
|
||||
- (CPDictionary)attributesAtIndex:(CPUInteger)anIndex effectiveRange:(CPRangePointer)aRange
|
||||
{
|
||||
// find the range entry that contains anIndex.
|
||||
var entryIndex = [self _indexOfEntryWithIndex:anIndex];
|
||||
@@ -219,7 +219,7 @@
|
||||
character at index \c anIndex. Returns an empty dictionary if index
|
||||
is out of bounds.
|
||||
*/
|
||||
- (CPDictionary)attributesAtIndex:(unsigned)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit
|
||||
- (CPDictionary)attributesAtIndex:(CPUInteger)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit
|
||||
{
|
||||
var startingEntryIndex = [self _indexOfEntryWithIndex:anIndex];
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
@return the named attribute or \c nil is the attribute does not
|
||||
exist.
|
||||
*/
|
||||
- (id)attribute:(CPString)attribute atIndex:(unsigned)index effectiveRange:(CPRangePointer)aRange
|
||||
- (id)attribute:(CPString)attribute atIndex:(CPUInteger)index effectiveRange:(CPRangePointer)aRange
|
||||
{
|
||||
if (!attribute)
|
||||
{
|
||||
@@ -332,7 +332,7 @@
|
||||
@return the named attribute or \c nil is the attribute does not
|
||||
exist.
|
||||
*/
|
||||
- (id)attribute:(CPString)attribute atIndex:(unsigned)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit
|
||||
- (id)attribute:(CPString)attribute atIndex:(CPUInteger)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit
|
||||
{
|
||||
var startingEntryIndex = [self _indexOfEntryWithIndex:anIndex];
|
||||
|
||||
@@ -690,7 +690,7 @@
|
||||
@param anIndex the index at which the insert is to occur.
|
||||
@exception CPRangeException If the index is out of bounds.
|
||||
*/
|
||||
- (void)insertAttributedString:(CPAttributedString)aString atIndex:(unsigned)anIndex
|
||||
- (void)insertAttributedString:(CPAttributedString)aString atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
if (anIndex < 0 || anIndex > [self length])
|
||||
[CPException raise:CPRangeException reason:"tried to insert attributed string at an invalid index: "+anIndex];
|
||||
|
||||
@@ -214,7 +214,7 @@ var CPByteCountFormatterUnits = [ @"bytes", @"KB", @"MB", @"GB", @"TB", @"PB" ];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL)getObjectValue:(id)anObject forString:(CPString)aString errorDescription:(CPString)anError
|
||||
- (BOOL)getObjectValue:(idRef)anObject forString:(CPString)aString errorDescription:(CPStringRef)anError
|
||||
{
|
||||
// Not implemented
|
||||
return NO;
|
||||
|
||||
@@ -1201,7 +1201,7 @@ var defaultDateFormatterBehavior = CPDateFormatterBehavior10_4,
|
||||
@param anError, if it returns NO the describe error will be in anError (use of ref)
|
||||
@return aBoolean for the success or fail of the method
|
||||
*/
|
||||
- (BOOL)getObjectValue:(id)anObject forString:(CPString)aString errorDescription:(CPString)anError
|
||||
- (BOOL)getObjectValue:(idRef)anObject forString:(CPString)aString errorDescription:(CPStringRef)anError
|
||||
{
|
||||
var value = [self dateFromString:aString];
|
||||
@deref(anObject) = value;
|
||||
|
||||
@@ -130,7 +130,20 @@ var CPDefaultDcmHandler = nil;
|
||||
@end
|
||||
|
||||
// CPDecimalNumberBehaviors protocol
|
||||
@implementation CPDecimalNumberHandler (CPDecimalNumberBehaviors)
|
||||
|
||||
@protocol CPDecimalNumberBehaviors
|
||||
|
||||
- (CPRoundingMode)roundingMode;
|
||||
|
||||
- (short)scale;
|
||||
// The scale could return NO_SCALE for no defined scale.
|
||||
|
||||
- (CPDecimalNumber)exceptionDuringOperation:(SEL)operation error:(CPCalculationError)error leftOperand:(CPDecimalNumber)leftOperand rightOperand:(CPDecimalNumber)rightOperand;
|
||||
// Receiver can raise, return a new value, or return nil to ignore the exception.
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPDecimalNumberHandler (CPDecimalNumberBehaviors) <CPDecimalNumberBehaviors>
|
||||
|
||||
/*!
|
||||
Returns the current rounding mode. One of \e CPRoundingMode enum:
|
||||
|
||||
@@ -91,7 +91,7 @@ CPFilePathErrorKey = @"CPFilePathErrorKey";
|
||||
return [_userInfo objectForKey:CPRecoveryAttempterErrorKey];
|
||||
}
|
||||
|
||||
- (id)description
|
||||
- (CPString)description
|
||||
{
|
||||
return [CPString stringWithFormat:@"Error Domain=%@ Code=%d UserInfo=%p %@", _domain, _code, _userInfo, [self localizedDescription]];
|
||||
}
|
||||
|
||||
@@ -1187,5 +1187,5 @@ X - (void)addIndex:(unsigned int)value;
|
||||
X - (void)removeIndex:(unsigned int)value;
|
||||
X - (void)addIndexesInRange:(NSRange)range;
|
||||
X - (void)removeIndexesInRange:(NSRange)range;
|
||||
- (void)shiftIndexesStartingAtIndex:(unsigned int)index by:(int)delta;
|
||||
- (void)shiftIndexesStartingAtIndex:(CPUInteger)index by:(int)delta;
|
||||
*/
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
@param anArgument the argument to add
|
||||
@param anIndex the index of the argument in the method
|
||||
*/
|
||||
- (void)setArgument:(id)anArgument atIndex:(unsigned)anIndex
|
||||
- (void)setArgument:(id)anArgument atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
_arguments[anIndex] = anArgument;
|
||||
}
|
||||
@@ -116,7 +116,7 @@
|
||||
@param anIndex the index of the argument to return
|
||||
@throws CPInvalidArgumentException if anIndex is greater than or equal to the invocation's number of arguments.
|
||||
*/
|
||||
- (id)argumentAtIndex:(unsigned)anIndex
|
||||
- (id)argumentAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
return _arguments[anIndex];
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)addObserver:(id)anObserver forKeyPath:(CPString)aPath options:(unsigned)options context:(id)aContext
|
||||
- (void)addObserver:(id)anObserver forKeyPath:(CPString)aPath options:(CPKeyValueObservingOptions)options context:(id)aContext
|
||||
{
|
||||
if (!anObserver || !aPath)
|
||||
return;
|
||||
@@ -742,7 +742,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_addObserver:(id)anObserver forKeyPath:(CPString)aPath options:(unsigned)options context:(id)aContext
|
||||
- (void)_addObserver:(id)anObserver forKeyPath:(CPString)aPath options:(CPKeyValueObservingOptions)options context:(id)aContext
|
||||
{
|
||||
if (!anObserver)
|
||||
return;
|
||||
|
||||
@@ -189,7 +189,7 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
|
||||
return [self stringForObjectValue:anObject];
|
||||
}
|
||||
|
||||
- (BOOL)getObjectValue:(id)anObjectRef forString:(CPString)aString errorDescription:(CPString)anErrorRef
|
||||
- (BOOL)getObjectValue:(idRef)anObjectRef forString:(CPString)aString errorDescription:(CPStringRef)anErrorRef
|
||||
{
|
||||
// Interpret an empty string as nil, like in Cocoa.
|
||||
if (aString === @"")
|
||||
|
||||
+56
-1
@@ -67,7 +67,42 @@ CPLog(@"Got some class: %@", inst);
|
||||
|
||||
@global CPInvalidArgumentException
|
||||
|
||||
@implementation CPObject
|
||||
|
||||
@protocol CPObject
|
||||
|
||||
- (BOOL)isEqual:(id)object;
|
||||
- (CPUInteger)hash;
|
||||
|
||||
- (Class)superclass;
|
||||
- (Class)class;
|
||||
- (id)self;
|
||||
|
||||
- (id)performSelector:(SEL)aSelector;
|
||||
- (id)performSelector:(SEL)aSelector withObject:(id)object;
|
||||
- (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2;
|
||||
|
||||
- (BOOL)isProxy;
|
||||
|
||||
- (BOOL)isKindOfClass:(Class)aClass;
|
||||
- (BOOL)isMemberOfClass:(Class)aClass;
|
||||
- (BOOL)conformsToProtocol:(Protocol)aProtocol;
|
||||
|
||||
- (BOOL)respondsToSelector:(SEL)aSelector;
|
||||
|
||||
- (CPString)description;
|
||||
@optional
|
||||
- (CPString)debugDescription;
|
||||
|
||||
@end
|
||||
|
||||
@protocol CPCoding
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder;
|
||||
- (id)initWithCoder:(CPCoder)aDecoder;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPObject <CPObject>
|
||||
{
|
||||
Class isa;
|
||||
}
|
||||
@@ -254,6 +289,26 @@ CPLog(@"Got some class: %@", inst);
|
||||
return NO;
|
||||
}
|
||||
|
||||
/*!
|
||||
Test whether instances of this class conforms to the provided protocol.
|
||||
@param aProtocol the protocol for which to test the class
|
||||
@return \c YES if instances of the class conforms to the protocol
|
||||
*/
|
||||
+ (BOOL)conformsToProtocol:(Protocol)aProtocol
|
||||
{
|
||||
return class_conformsToProtocol(self, aProtocol);
|
||||
}
|
||||
|
||||
/*!
|
||||
Tests whether the receiver conforms to the provided protocol.
|
||||
@param protocol the protocol for which to test the class
|
||||
@return \c YES if instances of the class conforms to the protocol
|
||||
*/
|
||||
- (BOOL)conformsToProtocol:(Protocol)aProtocol
|
||||
{
|
||||
return class_conformsToProtocol(isa, aProtocol);
|
||||
}
|
||||
|
||||
// Obtaining method information
|
||||
|
||||
/*!
|
||||
|
||||
@@ -329,7 +329,7 @@
|
||||
/* = Debug = */
|
||||
/* ========= */
|
||||
|
||||
- (void)description
|
||||
- (CPString)description
|
||||
{
|
||||
return [super description] + " {" + CPStringFromClass([self class]) + ", state = '" + ([self string].substr(0, _scanLocation) + "{{ SCAN LOCATION ->}}" + [self string].substr(_scanLocation)) + "'; }";
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
[_proxyObject setValue:anObject forKey:_key];
|
||||
}
|
||||
|
||||
- (unsigned)count
|
||||
- (CPUInteger)count
|
||||
{
|
||||
if (_count)
|
||||
return _count(_proxyObject, _countSEL);
|
||||
|
||||
@@ -206,7 +206,7 @@ var CPStringUIDs = new CFMutableDictionary(),
|
||||
Returns the character at the specified index.
|
||||
@param anIndex the index of the desired character
|
||||
*/
|
||||
- (CPString)characterAtIndex:(unsigned)anIndex
|
||||
- (CPString)characterAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
return self.charAt(anIndex);
|
||||
}
|
||||
@@ -249,7 +249,7 @@ var CPStringUIDs = new CFMutableDictionary(),
|
||||
@param anIndex the index of the padding string to start from (if necessary to use)
|
||||
@return the new padded string
|
||||
*/
|
||||
- (CPString)stringByPaddingToLength:(unsigned)aLength withString:(CPString)aString startingAtIndex:(unsigned)anIndex
|
||||
- (CPString)stringByPaddingToLength:(unsigned)aLength withString:(CPString)aString startingAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
if (self.length == aLength)
|
||||
return self;
|
||||
@@ -596,7 +596,7 @@ var CPStringNull = [CPNull null];
|
||||
/*!
|
||||
Returns a hash of the string instance.
|
||||
*/
|
||||
- (unsigned)UID
|
||||
- (CPString)UID
|
||||
{
|
||||
var UID = CPStringUIDs.valueForKey(self);
|
||||
|
||||
|
||||
@@ -45,7 +45,12 @@ Scope.prototype.isRootScope = function()
|
||||
|
||||
Scope.prototype.currentClassName = function()
|
||||
{
|
||||
return this.classDef ? this.classDef.className : this.prev ? this.prev.currentClassName() : null;
|
||||
return this.classDef ? this.classDef.name : this.prev ? this.prev.currentClassName() : null;
|
||||
}
|
||||
|
||||
Scope.prototype.currentProtocolName = function()
|
||||
{
|
||||
return this.protocolDef ? this.protocolDef.name : this.prev ? this.prev.currentProtocolName() : null;
|
||||
}
|
||||
|
||||
Scope.prototype.getIvarForCurrentClass = function(/* String */ ivarName)
|
||||
@@ -144,6 +149,215 @@ StringBuffer.prototype.isEmpty = function()
|
||||
return this.atoms.length !== 0;
|
||||
}
|
||||
|
||||
// Both the ClassDef and ProtocolDef conforms to a 'protocol' (That we can't declare in Javascript).
|
||||
// Both Objects have the attribute 'protocols': Array of ProtocolDef that they conform to
|
||||
// Both also have the functions: addInstanceMethod, addClassMethod, getInstanceMethod and getClassMethod
|
||||
// classDef = {"className": aClassName, "superClass": superClass , "ivars": myIvars, "instanceMethods": instanceMethodDefs, "classMethods": classMethodDefs, "protocols": myProtocols};
|
||||
var ClassDef = function(isImplementationDeclaration, name, superClass, ivars, instanceMethods, classMethods, protocols)
|
||||
{
|
||||
this.name = name;
|
||||
if (superClass)
|
||||
this.superClass = superClass;
|
||||
if (ivars)
|
||||
this.ivars = ivars;
|
||||
if (isImplementationDeclaration) {
|
||||
this.instanceMethods = instanceMethods || Object.create(null);
|
||||
this.classMethods = classMethods || Object.create(null);
|
||||
}
|
||||
if (protocols)
|
||||
this.protocols = protocols;
|
||||
}
|
||||
|
||||
ClassDef.prototype.addInstanceMethod = function(methodDef) {
|
||||
this.instanceMethods[methodDef.name] = methodDef;
|
||||
}
|
||||
|
||||
ClassDef.prototype.addClassMethod = function(methodDef) {
|
||||
this.classMethods[methodDef.name] = methodDef;
|
||||
}
|
||||
|
||||
ClassDef.prototype.listOfNotImplementedMethodsForProtocols = function(protocolDefs) {
|
||||
var resultList = [],
|
||||
instanceMethods = this.getInstanceMethods(),
|
||||
classMethods = this.getClassMethods();
|
||||
|
||||
for (var i = 0, size = protocolDefs.length; i < size; i++)
|
||||
{
|
||||
var protocolDef = protocolDefs[i],
|
||||
protocolInstanceMethods = protocolDef.requiredInstanceMethods,
|
||||
protocolClassMethods = protocolDef.requiredClassMethods,
|
||||
inheritFromProtocols = protocolDef.protocols;
|
||||
|
||||
if (protocolInstanceMethods) for (var methodName in protocolInstanceMethods) {
|
||||
var methodDef = protocolInstanceMethods[methodName];
|
||||
|
||||
if (!instanceMethods[methodName])
|
||||
resultList.push({"methodDef": methodDef, "protocolDef": protocolDef});
|
||||
}
|
||||
|
||||
if (protocolClassMethods) for (var methodName in protocolClassMethods) {
|
||||
var methodDef = protocolClassMethods[methodName];
|
||||
|
||||
if (!classMethods[methodName])
|
||||
resultList.push({"methodDef": methodDef, "protocolDef": protocolDef});
|
||||
}
|
||||
|
||||
if (inheritFromProtocols)
|
||||
resultList = resultList.concat(this.listOfNotImplementedMethodsForProtocols(inheritFromProtocols));
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
ClassDef.prototype.getInstanceMethod = function(name) {
|
||||
var instanceMethods = this.instanceMethods;
|
||||
|
||||
if (instanceMethods) {
|
||||
var method = instanceMethods[name];
|
||||
|
||||
if (method)
|
||||
return method;
|
||||
}
|
||||
|
||||
var superClass = this.superClass;
|
||||
|
||||
if (superClass)
|
||||
return superClass.getInstanceMethod(name);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
ClassDef.prototype.getClassMethod = function(name) {
|
||||
var classMethods = this.classMethods;
|
||||
if (classMethods) {
|
||||
var method = classMethods[name];
|
||||
|
||||
if (method)
|
||||
return method;
|
||||
}
|
||||
|
||||
var superClass = this.superClass;
|
||||
|
||||
if (superClass)
|
||||
return superClass.getClassMethod(name);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return a new Array with all instance methods
|
||||
ClassDef.prototype.getInstanceMethods = function() {
|
||||
var instanceMethods = this.instanceMethods;
|
||||
if (instanceMethods) {
|
||||
var superClass = this.superClass,
|
||||
returnObject = Object.create(null);
|
||||
if (superClass) {
|
||||
var superClassMethods = superClass.getInstanceMethods();
|
||||
for (var methodName in superClassMethods)
|
||||
returnObject[methodName] = superClassMethods[methodName];
|
||||
}
|
||||
|
||||
for (var methodName in instanceMethods)
|
||||
returnObject[methodName] = instanceMethods[methodName];
|
||||
|
||||
return returnObject;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
// Return a new Array with all class methods
|
||||
ClassDef.prototype.getClassMethods = function() {
|
||||
var classMethods = this.classMethods;
|
||||
if (classMethods) {
|
||||
var superClass = this.superClass,
|
||||
returnObject = Object.create(null);
|
||||
if (superClass) {
|
||||
var superClassMethods = superClass.getClassMethods();
|
||||
for (var methodName in superClassMethods)
|
||||
returnObject[methodName] = superClassMethods[methodName];
|
||||
}
|
||||
|
||||
for (var methodName in classMethods)
|
||||
returnObject[methodName] = classMethods[methodName];
|
||||
|
||||
return returnObject;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
// protocolDef = {"name": aProtocolName, "protocols": inheritFromProtocols, "requiredInstanceMethods": requiredInstanceMethodDefs, "requiredClassMethods": requiredClassMethodDefs};
|
||||
var ProtocolDef = function(name, protocols, requiredInstanceMethodDefs, requiredClassMethodDefs)
|
||||
{
|
||||
this.name = name;
|
||||
this.protocols = protocols;
|
||||
if (requiredInstanceMethodDefs)
|
||||
this.requiredInstanceMethods = requiredInstanceMethodDefs;
|
||||
if (requiredClassMethodDefs)
|
||||
this.requiredClassMethods = requiredClassMethodDefs;
|
||||
}
|
||||
|
||||
ProtocolDef.prototype.addInstanceMethod = function(methodDef) {
|
||||
(this.requiredInstanceMethods || (this.requiredInstanceMethods = Object.create(null)))[methodDef.name] = methodDef;
|
||||
}
|
||||
|
||||
ProtocolDef.prototype.addClassMethod = function(methodDef) {
|
||||
(this.requiredClassMethods || (this.requiredClassMethods = Object.create(null)))[methodDef.name] = methodDef;
|
||||
}
|
||||
|
||||
ProtocolDef.prototype.getInstanceMethod = function(name) {
|
||||
var instanceMethods = this.requiredInstanceMethods;
|
||||
|
||||
if (instanceMethods) {
|
||||
var method = instanceMethods[name];
|
||||
|
||||
if (method)
|
||||
return method;
|
||||
}
|
||||
|
||||
var protocols = this.protocols;
|
||||
|
||||
for (var i = 0, size = protocols.length; i < size; i++) {
|
||||
var protocol = protocols[i],
|
||||
method = protocol.getInstanceMethod(name);
|
||||
|
||||
if (method)
|
||||
return method;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
ProtocolDef.prototype.getClassMethod = function(name) {
|
||||
var classMethods = this.requiredClassMethods;
|
||||
|
||||
if (classMethods) {
|
||||
var method = classMethods[name];
|
||||
|
||||
if (method)
|
||||
return method;
|
||||
}
|
||||
|
||||
var protocols = this.protocols;
|
||||
|
||||
for (var i = 0, size = protocols.length; i < size; i++) {
|
||||
var protocol = protocols[i],
|
||||
method = protocol.getInstanceMethod(name);
|
||||
|
||||
if (method)
|
||||
return method;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// methodDef = {"types": types, "name": selector}
|
||||
var MethodDef = function(name, types)
|
||||
{
|
||||
this.name = name;
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
var currentCompilerFlags = "";
|
||||
|
||||
var reservedIdentifiers = exports.acorn.makePredicate("self _cmd undefined localStorage arguments");
|
||||
@@ -153,7 +367,7 @@ var wordPrefixOperators = exports.acorn.makePredicate("delete in instanceof new
|
||||
var isLogicalBinary = exports.acorn.makePredicate("LogicalExpression BinaryExpression");
|
||||
var isInInstanceof = exports.acorn.makePredicate("in instanceof");
|
||||
|
||||
var ObjJAcornCompiler = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags, /*unsigned*/ pass, /* Dictionary */ classDefs)
|
||||
var ObjJAcornCompiler = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags, /*unsigned*/ pass, /* Dictionary */ classDefs, /* Dictionary */ protocolDefs)
|
||||
{
|
||||
this.source = aString;
|
||||
this.URL = new CFURL(aURL);
|
||||
@@ -182,6 +396,7 @@ var ObjJAcornCompiler = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*
|
||||
this.dependencies = [];
|
||||
this.flags = flags | ObjJAcornCompiler.Flags.IncludeDebugSymbols;
|
||||
this.classDefs = classDefs ? classDefs : Object.create(null);
|
||||
this.protocolDefs = protocolDefs ? protocolDefs : Object.create(null);
|
||||
this.lastPos = 0;
|
||||
if (currentCompilerFlags & ObjJAcornCompiler.Flags.Generate)
|
||||
this.generate = true;
|
||||
@@ -198,9 +413,9 @@ exports.ObjJAcornCompiler.compileToExecutable = function(/*String*/ aString, /*C
|
||||
return new ObjJAcornCompiler(aString, aURL, flags, 2).executable();
|
||||
}
|
||||
|
||||
exports.ObjJAcornCompiler.compileToIMBuffer = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags, classDefs)
|
||||
exports.ObjJAcornCompiler.compileToIMBuffer = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags, classDefs, protocolDefs)
|
||||
{
|
||||
return new ObjJAcornCompiler(aString, aURL, flags, 2, classDefs).IMBuffer();
|
||||
return new ObjJAcornCompiler(aString, aURL, flags, 2, classDefs, protocolDefs).IMBuffer();
|
||||
}
|
||||
|
||||
exports.ObjJAcornCompiler.compileFileDependencies = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags)
|
||||
@@ -215,8 +430,8 @@ ObjJAcornCompiler.prototype.compilePass2 = function()
|
||||
this.pass = 2;
|
||||
this.jsBuffer = new StringBuffer();
|
||||
this.warnings = [];
|
||||
//print(this.URL + ": Compiling");
|
||||
compile(this.tokens, new Scope(null ,{ compiler: this }), pass2);
|
||||
|
||||
for (var i = 0; i < this.warnings.length; i++)
|
||||
{
|
||||
var message = this.prettifyMessage(this.warnings[i], "WARNING");
|
||||
@@ -227,6 +442,7 @@ ObjJAcornCompiler.prototype.compilePass2 = function()
|
||||
#endif
|
||||
}
|
||||
|
||||
//print(this.URL + ": " + this.jsBuffer.toString());
|
||||
return this.jsBuffer.toString();
|
||||
}
|
||||
|
||||
@@ -271,7 +487,7 @@ ObjJAcornCompiler.prototype.getIvarForClass = function(/* String */ ivarName, /*
|
||||
if (ivarDef)
|
||||
return ivarDef;
|
||||
}
|
||||
c = this.getClassDef(c.superClassName);
|
||||
c = c.superClass;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,37 +495,100 @@ ObjJAcornCompiler.prototype.getClassDef = function(/* String */ aClassName)
|
||||
{
|
||||
if (!aClassName) return null;
|
||||
|
||||
var c = this.classDefs[aClassName];
|
||||
var c = this.classDefs[aClassName];
|
||||
|
||||
if (c) return c;
|
||||
if (c) return c;
|
||||
|
||||
if (objj_getClass)
|
||||
{
|
||||
var aClass = objj_getClass(aClassName);
|
||||
if (aClass)
|
||||
{
|
||||
var ivars = class_copyIvarList(aClass),
|
||||
ivarSize = ivars.length,
|
||||
myIvars = Object.create(null),
|
||||
superClass = aClass.super_class;
|
||||
if (typeof objj_getClass === 'function')
|
||||
{
|
||||
var aClass = objj_getClass(aClassName);
|
||||
if (aClass)
|
||||
{
|
||||
var ivars = class_copyIvarList(aClass),
|
||||
ivarSize = ivars.length,
|
||||
myIvars = Object.create(null),
|
||||
protocols = class_copyProtocolList(aClass),
|
||||
protocolSize = protocols.length,
|
||||
myProtocols = Object.create(null),
|
||||
instanceMethodDefs = ObjJAcornCompiler.methodDefsFromMethodList(class_copyMethodList(aClass)),
|
||||
classMethodDefs = ObjJAcornCompiler.methodDefsFromMethodList(class_copyMethodList(aClass.isa)),
|
||||
superClass = class_getSuperclass(aClass);
|
||||
|
||||
for (var i = 0; i < ivarSize; i++)
|
||||
{
|
||||
var ivar = ivars[i];
|
||||
for (var i = 0; i < ivarSize; i++)
|
||||
{
|
||||
var ivar = ivars[i];
|
||||
|
||||
myIvars[ivar.name] = {"type": ivar.type, "name": ivar.name};
|
||||
}
|
||||
c = {"className": aClassName, "ivars": myIvars};
|
||||
myIvars[ivar.name] = {"type": ivar.type, "name": ivar.name};
|
||||
}
|
||||
|
||||
if (superClass)
|
||||
c.superClassName = superClass.name;
|
||||
this.classDefs[aClassName] = c;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < protocolSize; i++)
|
||||
{
|
||||
var protocol = protocols[i],
|
||||
protocolName = protocol_getName(protocol),
|
||||
protocolDef = this.getProtocolDef(protocolName);
|
||||
|
||||
return null;
|
||||
// classDef = {"className": className, "superClassName": superClassName, "ivars": Object.create(null), "methods": Object.create(null)};
|
||||
myProtocols[protocolName] = protocolDef;
|
||||
}
|
||||
|
||||
c = new ClassDef(true, aClassName, superClass ? this.getClassDef(superClass.name) : null, myIvars, instanceMethodDefs, classMethodDefs, myProtocols);
|
||||
this.classDefs[aClassName] = c;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
ObjJAcornCompiler.prototype.getProtocolDef = function(/* String */ aProtocolName)
|
||||
{
|
||||
if (!aProtocolName) return null;
|
||||
|
||||
var p = this.protocolDefs[aProtocolName];
|
||||
|
||||
if (p) return p;
|
||||
|
||||
if (typeof objj_getProtocol === 'function')
|
||||
{
|
||||
var aProtocol = objj_getProtocol(aProtocolName);
|
||||
if (aProtocol)
|
||||
{
|
||||
var protocolName = protocol_getName(aProtocol),
|
||||
requiredInstanceMethods = protocol_copyMethodDescriptionList(aProtocol, true, true),
|
||||
requiredInstanceMethodDefs = ObjJAcornCompiler.methodDefsFromMethodList(requiredInstanceMethods),
|
||||
requiredClassMethods = protocol_copyMethodDescriptionList(aProtocol, true, false),
|
||||
requiredClassMethodDefs = ObjJAcornCompiler.methodDefsFromMethodList(requiredClassMethods),
|
||||
protocols = aProtocol.protocols,
|
||||
inheritFromProtocols = [];
|
||||
|
||||
if (protocols)
|
||||
for (var i = 0, size = protocols.length; i < size; i++)
|
||||
inheritFromProtocols.push(compiler.getProtocolDef(protocols[i].name));
|
||||
|
||||
p = new ProtocolDef(protocolName, inheritFromProtocols, requiredInstanceMethodDefs, requiredClassMethodDefs);
|
||||
|
||||
this.protocolDefs[aProtocolName] = p;
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
// protocolDef = {"name": protocolName, "protocols": Object.create(null), "required": Object.create(null), "optional": Object.create(null)};
|
||||
}
|
||||
|
||||
ObjJAcornCompiler.methodDefsFromMethodList = function(/* Array */ methodList)
|
||||
{
|
||||
var methodSize = methodList.length,
|
||||
myMethods = Object.create(null);
|
||||
|
||||
for (var i = 0; i < methodSize; i++)
|
||||
{
|
||||
var method = methodList[i],
|
||||
methodName = method_getName(method);
|
||||
|
||||
myMethods[methodName] = new MethodDef(methodName, method.types);
|
||||
}
|
||||
|
||||
return myMethods;
|
||||
}
|
||||
|
||||
ObjJAcornCompiler.prototype.executable = function()
|
||||
@@ -372,7 +651,9 @@ function createMessage(/* String */ aMessage, /* SpiderMonkey AST node */ node,
|
||||
|
||||
function compile(node, state, visitor) {
|
||||
function c(node, st, override) {
|
||||
//print("c: " + (override ? override + ", " : "") + node.type + ", " + exports.acorn.getLineInfo(st.compiler.source, node.start).line);
|
||||
visitor[override || node.type](node, st, c);
|
||||
//print("cc: " + (override ? override + ", " : "") + node.type + ", " + exports.acorn.getLineInfo(st.compiler.source, node.end).line);
|
||||
}
|
||||
c(node, state);
|
||||
};
|
||||
@@ -1303,10 +1584,12 @@ ImportStatement: function(node, st, c) {
|
||||
ClassDeclarationStatement: function(node, st, c) {
|
||||
var compiler = st.compiler,
|
||||
generate = compiler.generate,
|
||||
classDef,
|
||||
saveJSBuffer = compiler.jsBuffer,
|
||||
className = node.classname.name,
|
||||
classScope = new Scope(st);
|
||||
classDef = compiler.getClassDef(className),
|
||||
classScope = new Scope(st),
|
||||
isInterfaceDeclaration = node.type === "InterfaceDeclarationStatement",
|
||||
protocols = node.protocols;
|
||||
|
||||
compiler.imBuffer = new StringBuffer();
|
||||
compiler.cmBuffer = new StringBuffer();
|
||||
@@ -1317,10 +1600,19 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
// First we declare the class
|
||||
if (node.superclassname)
|
||||
{
|
||||
classDef = compiler.getClassDef(className);
|
||||
if (classDef && classDef.ivars) // Must have ivars dictionary to be a real declaration. Without it is a "@class" declaration
|
||||
// Must have methods dictionaries and ivars dictionary to be a real implementaion declaration.
|
||||
// Without it is a "@class" declaration (without both ivars dictionary and method dictionaries) or
|
||||
// "interface" declaration (without ivars dictionary)
|
||||
// TODO: Create a ClassDef object and add this logic to it
|
||||
if (classDef && classDef.ivars)
|
||||
// It has a real implementation declaration already
|
||||
throw compiler.error_message("Duplicate class " + className, node.classname);
|
||||
if (!compiler.getClassDef(node.superclassname.name))
|
||||
|
||||
if (isInterfaceDeclaration && classDef && classDef.instanceMethods && classDef.classMethods)
|
||||
// It has a interface declaration already
|
||||
throw compiler.error_message("Duplicate interface definition for class " + className, node.classname);
|
||||
var superClassDef = compiler.getClassDef(node.superclassname.name);
|
||||
if (!superClassDef)
|
||||
{
|
||||
var errorMessage = "Can't find superclass " + node.superclassname.name;
|
||||
for (var i = ObjJAcornCompiler.importStack.length; --i >= 0;)
|
||||
@@ -1328,7 +1620,7 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
throw compiler.error_message(errorMessage, node.superclassname);
|
||||
}
|
||||
|
||||
classDef = {"className": className, "superClassName": node.superclassname.name, "ivars": Object.create(null), "methods": Object.create(null)};
|
||||
classDef = new ClassDef(!isInterfaceDeclaration, className, superClassDef, Object.create(null));
|
||||
|
||||
saveJSBuffer.concat("{var the_class = objj_allocateClassPair(" + node.superclassname.name + ", \"" + className + "\"),\nmeta_class = the_class.isa;");
|
||||
}
|
||||
@@ -1344,11 +1636,21 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
}
|
||||
else
|
||||
{
|
||||
classDef = {"className": className, "superClassName": null, "ivars": Object.create(null), "methods": Object.create(null)};
|
||||
classDef = new ClassDef(!isInterfaceDeclaration, className, null, Object.create(null));
|
||||
|
||||
saveJSBuffer.concat("{var the_class = objj_allocateClassPair(Nil, \"" + className + "\"),\nmeta_class = the_class.isa;");
|
||||
}
|
||||
|
||||
if (protocols) for (var i = 0, size = protocols.length; i < size; i++)
|
||||
{
|
||||
saveJSBuffer.concat("\nvar aProtocol = objj_getProtocol(\"" + protocols[i].name + "\");");
|
||||
saveJSBuffer.concat("\nif (!aProtocol) throw new SyntaxError(\"*** Could not find definition for protocol \\\"" + protocols[i].name + "\\\"\");");
|
||||
saveJSBuffer.concat("\nclass_addProtocol(the_class, aProtocol);");
|
||||
}
|
||||
/*
|
||||
if (isInterfaceDeclaration)
|
||||
classDef.interfaceDeclaration = true;
|
||||
*/
|
||||
classScope.classDef = classDef;
|
||||
compiler.currentSuperClass = "objj_getClass(\"" + className + "\").super_class";
|
||||
compiler.currentSuperMetaClass = "objj_getMetaClass(\"" + className + "\").super_class";
|
||||
@@ -1362,7 +1664,12 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
var ivarDecl = node.ivardeclarations[i],
|
||||
ivarType = ivarDecl.ivartype ? ivarDecl.ivartype.name : null,
|
||||
ivarName = ivarDecl.id.name,
|
||||
ivar = {"type": ivarType, "name": ivarName};
|
||||
ivars = classDef.ivars,
|
||||
ivar = {"type": ivarType, "name": ivarName},
|
||||
accessors = ivarDecl.accessors;
|
||||
|
||||
if (ivars[ivarName])
|
||||
throw compiler.error_message("Instance variable '" + ivarName + "'is already declared for class " + className, ivarDecl.id);
|
||||
|
||||
if (firstIvarDeclaration)
|
||||
{
|
||||
@@ -1379,20 +1686,38 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
|
||||
if (ivarDecl.outlet)
|
||||
ivar.outlet = true;
|
||||
classDef.ivars[ivarName] = ivar;
|
||||
ivars[ivarName] = ivar;
|
||||
if (!classScope.ivars)
|
||||
classScope.ivars = Object.create(null);
|
||||
classScope.ivars[ivarName] = {type: "ivar", name: ivarName, node: ivarDecl.id, ivar: ivar};
|
||||
|
||||
if (!hasAccessors && ivarDecl.accessors)
|
||||
if (accessors) {
|
||||
// TODO: This next couple of lines for getting getterName and setterName are duplicated from below. Create functions for this.
|
||||
var property = (accessors.property && accessors.property.name) || ivarName,
|
||||
getterName = (accessors.getter && accessors.getter.name) || property;
|
||||
|
||||
classDef.addInstanceMethod(new MethodDef(getterName, [ivarType]));
|
||||
|
||||
if (!accessors.readonly) {
|
||||
var setterName = accessors.setter ? accessors.setter.name : null;
|
||||
|
||||
if (!setterName)
|
||||
{
|
||||
var start = property.charAt(0) == '_' ? 1 : 0;
|
||||
|
||||
setterName = (start ? "_" : "") + "set" + property.substr(start, 1).toUpperCase() + property.substring(start + 1) + ":";
|
||||
}
|
||||
classDef.addInstanceMethod(new MethodDef(setterName, ["void", ivarType]));
|
||||
}
|
||||
hasAccessors = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!firstIvarDeclaration)
|
||||
saveJSBuffer.concat("]);");
|
||||
|
||||
// If we have accessors add get and set methods for them
|
||||
if (hasAccessors)
|
||||
if (!isInterfaceDeclaration && hasAccessors)
|
||||
{
|
||||
var getterSetterBuffer = new StringBuffer();
|
||||
|
||||
@@ -1442,7 +1767,7 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
|
||||
// Remove all @accessors or we will get a recursive loop in infinity
|
||||
var b = getterSetterBuffer.toString().replace(/@accessors(\(.*\))?/g, "");
|
||||
var imBuffer = ObjJAcornCompiler.compileToIMBuffer(b, "Accessors", compiler.flags, compiler.classDefs);
|
||||
var imBuffer = ObjJAcornCompiler.compileToIMBuffer(b, "Accessors", compiler.flags, compiler.classDefs, compiler.protocolDefs);
|
||||
|
||||
// Add the accessors methods first to instance method buffer.
|
||||
// This will allow manually added set and get methods to override the compiler generated
|
||||
@@ -1452,20 +1777,22 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
// We will store the classDef first after accessors are done so we don't get a duplicate class error
|
||||
compiler.classDefs[className] = classDef;
|
||||
|
||||
if (node.body.length > 0)
|
||||
var bodies = node.body,
|
||||
bodyLength = bodies.length;
|
||||
|
||||
if (bodyLength > 0)
|
||||
{
|
||||
if (!generate) compiler.lastPos = node.body[0].start;
|
||||
if (!generate) compiler.lastPos = bodies[0].start;
|
||||
|
||||
// And last add methods and other statements
|
||||
for (var i = 0; i < node.body.length; ++i) {
|
||||
var body = node.body[i];
|
||||
for (var i = 0; i < bodyLength; ++i) {
|
||||
var body = bodies[i];
|
||||
c(body, classScope, "Statement");
|
||||
}
|
||||
if (!generate) saveJSBuffer.concat(compiler.source.substring(compiler.lastPos, body.end));
|
||||
}
|
||||
|
||||
// We must make a new class object for our class definition if it's not a category
|
||||
if (!node.categoryname) {
|
||||
if (!isInterfaceDeclaration && !node.categoryname) {
|
||||
saveJSBuffer.concat("objj_registerClassPair(the_class);\n");
|
||||
}
|
||||
|
||||
@@ -1491,23 +1818,149 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
|
||||
// Skip the "@end"
|
||||
if (!generate) compiler.lastPos = node.end;
|
||||
|
||||
// If the class conforms to protocols check that all required methods are implemented
|
||||
if (protocols)
|
||||
{
|
||||
// Lookup the protocolDefs for the protocols
|
||||
var protocolDefs = [];
|
||||
|
||||
for (var i = 0, size = protocols.length; i < size; i++)
|
||||
protocolDefs.push(compiler.getProtocolDef(protocols[i].name));
|
||||
|
||||
var unimplementedMethods = classDef.listOfNotImplementedMethodsForProtocols(protocolDefs);
|
||||
|
||||
if (unimplementedMethods && unimplementedMethods.length > 0)
|
||||
for (var i = 0, size = unimplementedMethods.length; i < size; i++) {
|
||||
var unimplementedMethod = unimplementedMethods[i],
|
||||
methodDef = unimplementedMethod.methodDef,
|
||||
protocolDef = unimplementedMethod.protocolDef;
|
||||
|
||||
compiler.addWarning(createMessage("Method '" + methodDef.name + "' in protocol '" + protocolDef.name + "' is not implemented", node.classname, compiler.source));
|
||||
}
|
||||
}
|
||||
},
|
||||
ProtocolDeclarationStatement: function(node, st, c) {
|
||||
var compiler = st.compiler,
|
||||
generate = compiler.generate,
|
||||
buffer = compiler.jsBuffer,
|
||||
protocolName = node.protocolname.name,
|
||||
protocolDef = compiler.getProtocolDef(protocolName),
|
||||
protocols = node.protocols,
|
||||
protocolScope = new Scope(st),
|
||||
inheritFromProtocols = [];
|
||||
|
||||
if (protocolDef)
|
||||
throw compiler.error_message("Duplicate protocol " + protocolName, node.protocolname);
|
||||
|
||||
compiler.imBuffer = new StringBuffer();
|
||||
compiler.cmBuffer = new StringBuffer();
|
||||
|
||||
if (!generate) buffer.concat(compiler.source.substring(compiler.lastPos, node.start));
|
||||
|
||||
buffer.concat("{var the_protocol = objj_allocateProtocol(\"" + protocolName + "\");");
|
||||
|
||||
if (protocols) for (var i = 0, size = protocols.length; i < size; i++)
|
||||
{
|
||||
var protocol = protocols[i],
|
||||
inheritFromProtocolName = protocol.name;
|
||||
inheritProtocolDef = compiler.getProtocolDef(inheritFromProtocolName);
|
||||
|
||||
if (!inheritProtocolDef)
|
||||
throw compiler.error_message("Can't find protocol " + inheritFromProtocolName, protocol);
|
||||
|
||||
buffer.concat("\nvar aProtocol = objj_getProtocol(\"" + inheritFromProtocolName + "\");");
|
||||
buffer.concat("\nif (!aProtocol) throw new SyntaxError(\"*** Could not find definition for protocol \\\"" + protocolName + "\\\"\");");
|
||||
buffer.concat("\nprotocol_addProtocol(the_protocol, aProtocol);");
|
||||
inheritFromProtocols.push(inheritProtocolDef);
|
||||
}
|
||||
|
||||
protocolDef = new ProtocolDef(protocolName, inheritFromProtocols);
|
||||
compiler.protocolDefs[protocolName] = protocolDef;
|
||||
protocolScope.protocolDef = protocolDef;
|
||||
|
||||
var someRequired = node.required;
|
||||
|
||||
if (someRequired) {
|
||||
var requiredLength = someRequired.length;
|
||||
|
||||
if (requiredLength > 0)
|
||||
{
|
||||
// We only add the required methods
|
||||
for (var i = 0; i < requiredLength; ++i) {
|
||||
var required = someRequired[i];
|
||||
if (!generate) compiler.lastPos = required.start;
|
||||
c(required, protocolScope, "Statement");
|
||||
}
|
||||
if (!generate) buffer.concat(compiler.source.substring(compiler.lastPos, required.end));
|
||||
}
|
||||
}
|
||||
|
||||
buffer.concat("\nobjj_registerProtocol(the_protocol);\n");
|
||||
|
||||
// Add instance methods
|
||||
if (compiler.imBuffer.isEmpty())
|
||||
{
|
||||
buffer.concat("protocol_addMethodDescriptions(the_protocol, [");
|
||||
buffer.atoms.push.apply(buffer.atoms, compiler.imBuffer.atoms); // FIXME: Move this append to StringBuffer
|
||||
buffer.concat("], true, true);\n");
|
||||
}
|
||||
|
||||
// Add class methods
|
||||
if (compiler.cmBuffer.isEmpty())
|
||||
{
|
||||
buffer.concat("protocol_addMethodDescriptions(the_protocol, [");
|
||||
buffer.atoms.push.apply(buffer.atoms, compiler.cmBuffer.atoms); // FIXME: Move this append to StringBuffer
|
||||
buffer.concat("], true, false);\n");
|
||||
}
|
||||
|
||||
buffer.concat("}");
|
||||
|
||||
compiler.jsBuffer = buffer;
|
||||
|
||||
// Skip the "@end"
|
||||
if (!generate) compiler.lastPos = node.end;
|
||||
},
|
||||
MethodDeclarationStatement: function(node, st, c) {
|
||||
var compiler = st.compiler,
|
||||
generate = compiler.generate,
|
||||
saveJSBuffer = compiler.jsBuffer,
|
||||
methodScope = new Scope(st),
|
||||
isInstanceMethodType = node.methodtype === '-';
|
||||
selectors = node.selectors,
|
||||
arguments = node.arguments,
|
||||
types = [node.returntype ? node.returntype.name : "id"],
|
||||
nodeArguments = node.arguments,
|
||||
returnType = node.returntype,
|
||||
types = [returnType ? returnType.name : (node.action ? "void" : "id")],
|
||||
returnTypeProtocols = returnType ? returnType.protocols : null;
|
||||
selector = selectors[0].name; // There is always at least one selector
|
||||
|
||||
if (returnTypeProtocols) for (var i = 0, size = returnTypeProtocols.length; i < size; i++) {
|
||||
var returnTypeProtocol = returnTypeProtocols[i];
|
||||
if (!compiler.getProtocolDef(returnTypeProtocol.name)) {
|
||||
compiler.addWarning(createMessage("Cannot find protocol declaration for '" + returnTypeProtocol.name + "'", returnTypeProtocol, compiler.source));
|
||||
}
|
||||
}
|
||||
|
||||
if (!generate) saveJSBuffer.concat(compiler.source.substring(compiler.lastPos, node.start));
|
||||
|
||||
compiler.jsBuffer = node.methodtype === '-' ? compiler.imBuffer : compiler.cmBuffer;
|
||||
compiler.jsBuffer = isInstanceMethodType ? compiler.imBuffer : compiler.cmBuffer;
|
||||
|
||||
// Put together the selector. Maybe this should be done in the parser...
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
for (var i = 0; i < nodeArguments.length; i++) {
|
||||
var argument = nodeArguments[i],
|
||||
argumentType = argument.type,
|
||||
argumentTypeName = argumentType ? argumentType.name : "id",
|
||||
argumentProtocols = argumentType ? argumentType.protocols : null;
|
||||
|
||||
types.push(argumentType ? argumentType.name : "id");
|
||||
|
||||
if (argumentProtocols) for (var j = 0, size = argumentProtocols.length; j < size; j++) {
|
||||
var argumentProtocol = argumentProtocols[j];
|
||||
if (!compiler.getProtocolDef(argumentProtocol.name)) {
|
||||
compiler.addWarning(createMessage("Cannot find protocol declaration for '" + argumentProtocol.name + "'", argumentProtocol, compiler.source));
|
||||
}
|
||||
}
|
||||
|
||||
if (i === 0)
|
||||
selector += ":";
|
||||
else
|
||||
@@ -1516,45 +1969,112 @@ MethodDeclarationStatement: function(node, st, c) {
|
||||
|
||||
if (compiler.jsBuffer.isEmpty()) // Add comma separator if this is not first method in this buffer
|
||||
compiler.jsBuffer.concat(", ");
|
||||
|
||||
compiler.jsBuffer.concat("new objj_method(sel_getUid(\"");
|
||||
compiler.jsBuffer.concat(selector);
|
||||
compiler.jsBuffer.concat("\"), function");
|
||||
compiler.jsBuffer.concat("\"), ");
|
||||
|
||||
// this.currentSelector = selector;
|
||||
if (node.body) {
|
||||
compiler.jsBuffer.concat("function");
|
||||
|
||||
if (compiler.flags & ObjJAcornCompiler.Flags.IncludeDebugSymbols)
|
||||
{
|
||||
compiler.jsBuffer.concat(" $" + st.currentClassName() + "__" + selector.replace(/:/g, "_"));
|
||||
if (compiler.flags & ObjJAcornCompiler.Flags.IncludeDebugSymbols)
|
||||
{
|
||||
compiler.jsBuffer.concat(" $" + st.currentClassName() + "__" + selector.replace(/:/g, "_"));
|
||||
}
|
||||
|
||||
compiler.jsBuffer.concat("(self, _cmd");
|
||||
|
||||
methodScope.methodType = node.methodtype;
|
||||
if (nodeArguments) for (var i = 0; i < nodeArguments.length; i++)
|
||||
{
|
||||
var argument = nodeArguments[i],
|
||||
argumentName = argument.identifier.name;
|
||||
|
||||
compiler.jsBuffer.concat(", ");
|
||||
compiler.jsBuffer.concat(argumentName);
|
||||
methodScope.vars[argumentName] = {type: "method argument", node: argument};
|
||||
}
|
||||
|
||||
compiler.jsBuffer.concat(")\n");
|
||||
|
||||
if (!generate) compiler.lastPos = node.startOfBody;
|
||||
indentation += indentStep;
|
||||
c(node.body, methodScope, "Statement");
|
||||
indentation = indentation.substring(indentationSpaces);
|
||||
if (!generate) compiler.jsBuffer.concat(compiler.source.substring(compiler.lastPos, node.body.end));
|
||||
|
||||
compiler.jsBuffer.concat("\n");
|
||||
} else { // It is a interface or protocol declatartion and we don't have a method implementation
|
||||
compiler.jsBuffer.concat("Nil\n");
|
||||
}
|
||||
|
||||
compiler.jsBuffer.concat("(self, _cmd");
|
||||
|
||||
methodScope.methodType = node.methodtype;
|
||||
if (arguments) for (var i = 0; i < arguments.length; i++)
|
||||
{
|
||||
var argument = arguments[i],
|
||||
argumentName = argument.identifier.name;
|
||||
|
||||
compiler.jsBuffer.concat(", ");
|
||||
compiler.jsBuffer.concat(argumentName);
|
||||
types.push(argument.type ? argument.type.name : null);
|
||||
methodScope.vars[argumentName] = {type: "method argument", node: argument};
|
||||
}
|
||||
|
||||
compiler.jsBuffer.concat(")\n");
|
||||
|
||||
if (!generate) compiler.lastPos = node.startOfBody;
|
||||
indentation += indentStep;
|
||||
c(node.body, methodScope, "Statement");
|
||||
indentation = indentation.substring(indentationSpaces);
|
||||
if (!generate) compiler.jsBuffer.concat(compiler.source.substring(compiler.lastPos, node.body.end));
|
||||
|
||||
compiler.jsBuffer.concat("\n");
|
||||
if (compiler.flags & ObjJAcornCompiler.Flags.IncludeDebugSymbols)
|
||||
compiler.jsBuffer.concat(","+JSON.stringify(types));
|
||||
|
||||
compiler.jsBuffer.concat(")");
|
||||
compiler.jsBuffer = saveJSBuffer;
|
||||
|
||||
if (!generate) compiler.lastPos = node.end;
|
||||
|
||||
// Add the method to the class or protocol definition
|
||||
var def = st.classDef,
|
||||
alreadyDeclared;
|
||||
|
||||
// But first, if it is a class definition check if it is declared in superclass or interface declaration
|
||||
if (def)
|
||||
alreadyDeclared = isInstanceMethodType ? def.getInstanceMethod(selector) : def.getClassMethod(selector);
|
||||
else
|
||||
def = st.protocolDef;
|
||||
|
||||
if (!def)
|
||||
throw "InternalError: MethodDeclaration without ClassDeclaration or ProtocolDeclaration at line: " + exports.acorn.getLineInfo(compiler.source, node.start).line;
|
||||
|
||||
// Create warnings if types does not corresponds to method declaration in superclass or interface declarations
|
||||
// If we don't find the method in superclass or interface declarations above or if it is a protocol
|
||||
// declaration, try to find it in any of the conforming protocols
|
||||
if (!alreadyDeclared) {
|
||||
var protocols = def.protocols;
|
||||
|
||||
if (protocols) for (var i = 0, size = protocols.length; i < size; i++) {
|
||||
var protocol = protocols[i],
|
||||
alreadyDeclared = isInstanceMethodType ? protocol.getInstanceMethod(selector) : protocol.getClassMethod(selector);
|
||||
|
||||
if (alreadyDeclared)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (alreadyDeclared) {
|
||||
var declaredTypes = alreadyDeclared.types;
|
||||
|
||||
if (declaredTypes) {
|
||||
var typeSize = declaredTypes.length;
|
||||
if (typeSize > 0) {
|
||||
// First type is return type
|
||||
var declaredReturnType = declaredTypes[0];
|
||||
|
||||
// Create warning if return types is not the same. It is ok if superclass has 'id' and subclass has a class type
|
||||
if (declaredReturnType !== types[0] && !(declaredReturnType === 'id' && returnType && returnType.typeisclass))
|
||||
compiler.addWarning(createMessage("Conflicting return type in implementation of '" + selector + "': '" + declaredReturnType + "' vs '" + types[0] + "'", returnType || node.action || selectors[0], compiler.source));
|
||||
|
||||
// Check the parameter types. The size of the two type arrays should be the same as they have the same selector.
|
||||
for (var i = 1; i < typeSize; i++) {
|
||||
var parameterType = declaredTypes[i];
|
||||
|
||||
if (parameterType !== types[i] && !(parameterType === 'id' && nodeArguments[i - 1].type.typeisclass))
|
||||
compiler.addWarning(createMessage("Conflicting parameter types in implementation of '" + selector + "': '" + parameterType + "' vs '" + types[i] + "'", nodeArguments[i - 1].type || nodeArguments[i - 1].identifier, compiler.source));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now we add it
|
||||
var methodDef = new MethodDef(selector, types);
|
||||
|
||||
if (isInstanceMethodType)
|
||||
def.addInstanceMethod(methodDef);
|
||||
else
|
||||
def.addClassMethod(methodDef);
|
||||
},
|
||||
MessageSendExpression: function(node, st, c) {
|
||||
var compiler = st.compiler,
|
||||
@@ -1639,6 +2159,19 @@ SelectorLiteralExpression: function(node, st, c) {
|
||||
buffer.concat("\")");
|
||||
if (!generate) compiler.lastPos = node.end;
|
||||
},
|
||||
ProtocolLiteralExpression: function(node, st, c) {
|
||||
var compiler = st.compiler,
|
||||
buffer = compiler.jsBuffer,
|
||||
generate = compiler.generate;
|
||||
if (!generate) {
|
||||
buffer.concat(compiler.source.substring(compiler.lastPos, node.start));
|
||||
buffer.concat(" "); // Add an extra space if it looks something like this: "return(@protocol(a))". No space between return and expression.
|
||||
}
|
||||
buffer.concat("objj_getProtocol(\"");
|
||||
buffer.concat(node.id.name);
|
||||
buffer.concat("\")");
|
||||
if (!generate) compiler.lastPos = node.end;
|
||||
},
|
||||
Reference: function(node, st, c) {
|
||||
var compiler = st.compiler,
|
||||
buffer = compiler.jsBuffer,
|
||||
@@ -1680,7 +2213,7 @@ ClassStatement: function(node, st, c) {
|
||||
}
|
||||
var className = node.id.name;
|
||||
if (!compiler.getClassDef(className)) {
|
||||
classDef = {"className": className};
|
||||
classDef = new ClassDef(false, className);
|
||||
compiler.classDefs[className] = classDef;
|
||||
}
|
||||
st.vars[node.id.name] = {type: "class", node: node.id};
|
||||
|
||||
+161
-1
@@ -47,7 +47,7 @@ GLOBAL(objj_ivar) = function(/*String*/ aName, /*String*/ aType)
|
||||
this.type = aType;
|
||||
}
|
||||
|
||||
GLOBAL(objj_method) = function(/*String*/ aName, /*IMP*/ anImplementation, /*String*/ types)
|
||||
GLOBAL(objj_method) = function(/*String*/ aName, /*IMP*/ anImplementation, /*Array<String>*/ types)
|
||||
{
|
||||
this.name = aName;
|
||||
this.method_imp = anImplementation;
|
||||
@@ -74,6 +74,8 @@ GLOBAL(objj_class) = function(displayName)
|
||||
this.method_store = function() { };
|
||||
this.method_dtable = this.method_store.prototype;
|
||||
|
||||
this.protocol_list = [];
|
||||
|
||||
#if DEBUG
|
||||
// Naming the allocator allows the WebKit heap snapshot tool to display object class names correctly
|
||||
// HACK: displayName property is not respected so we must eval a function to name it
|
||||
@@ -85,6 +87,13 @@ GLOBAL(objj_class) = function(displayName)
|
||||
this._UID = -1;
|
||||
}
|
||||
|
||||
GLOBAL(objj_protocol) = function(/*String*/ aName)
|
||||
{
|
||||
this.name = aName;
|
||||
this.instance_methods = { };
|
||||
this.class_methods = { };
|
||||
}
|
||||
|
||||
GLOBAL(objj_object) = function()
|
||||
{
|
||||
this.isa = NULL;
|
||||
@@ -288,6 +297,149 @@ GLOBAL(class_replaceMethod) = function(/*Class*/ aClass, /*SEL*/ aSelector, /*IM
|
||||
return method_imp;
|
||||
}
|
||||
|
||||
GLOBAL(class_addProtocol) = function(/*Class*/ aClass, /*Protocol*/ aProtocol)
|
||||
{
|
||||
if (!aProtocol || class_conformsToProtocol(aClass, aProtocol))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
(aClass.protocol_list || (aClass.protocol_list == [])).push(aProtocol);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GLOBAL(class_conformsToProtocol) = function(/*Class*/ aClass, /*Protocol*/ aProtocol)
|
||||
{
|
||||
if (!aProtocol)
|
||||
return false;
|
||||
|
||||
while (aClass)
|
||||
{
|
||||
var protocols = aClass.protocol_list,
|
||||
size = protocols ? protocols.length : 0;
|
||||
|
||||
for (var i = 0; i < size; i++)
|
||||
{
|
||||
var p = protocols[i];
|
||||
|
||||
if (p.name === aProtocol.name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (protocol_conformsToProtocol(p, aProtocol))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
aClass = class_getSuperclass(aClass);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
GLOBAL(class_copyProtocolList) = function(/*Class*/ aClass)
|
||||
{
|
||||
var protocols = aClass.protocol_list;
|
||||
|
||||
return protocols ? protocols.slice(0) : [];
|
||||
}
|
||||
|
||||
GLOBAL(protocol_conformsToProtocol) = function(/*Protocol*/ p1, /*Protocol*/ p2)
|
||||
{
|
||||
if (!p1 || !p2)
|
||||
return false;
|
||||
|
||||
if (p1.name === p2.name)
|
||||
return true;
|
||||
|
||||
var protocols = p1.protocol_list,
|
||||
size = protocols ? protocols.length : 0;
|
||||
|
||||
for (var i = 0; i < size; i++)
|
||||
{
|
||||
var p = protocols[i];
|
||||
|
||||
if (p.name === p2.name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (protocol_conformsToProtocol(p, p2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var REGISTERED_PROTOCOLS = { };
|
||||
|
||||
GLOBAL(objj_allocateProtocol) = function(/*String*/ aName)
|
||||
{
|
||||
var protocol = new objj_protocol(aName);
|
||||
|
||||
return protocol;
|
||||
}
|
||||
|
||||
GLOBAL(objj_registerProtocol) = function(/*Protocol*/ proto)
|
||||
{
|
||||
REGISTERED_PROTOCOLS[proto.name] = proto;
|
||||
}
|
||||
|
||||
GLOBAL(protocol_getName) = function(/*Protocol*/ proto)
|
||||
{
|
||||
return proto.name;
|
||||
}
|
||||
|
||||
// Right now we only register required methods. THis might need to change in the future
|
||||
GLOBAL(protocol_addMethodDescription) = function(/*Protocol*/ proto, /*SEL*/ selector, /*Array*/ types, /*BOOL*/ isRequiredMethod, /*BOOL*/ isInstanceMethod)
|
||||
{
|
||||
if (!proto || !selector) return;
|
||||
|
||||
if (isRequiredMethod)
|
||||
(isInstanceMethod ? proto.instance_methods : proto.class_methods)[selector] = new objj_method(selector, null, types);
|
||||
}
|
||||
|
||||
GLOBAL(protocol_addMethodDescriptions) = function(/*Protocol*/ proto, /*Array*/ methods, /*BOOL*/ isRequiredMethod, /*BOOL*/ isInstanceMethod)
|
||||
{
|
||||
if (!isRequiredMethod) return;
|
||||
|
||||
var index = 0,
|
||||
count = methods.length,
|
||||
method_dtable = isInstanceMethod ? proto.instance_methods : proto.class_methods;
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var method = methods[index];
|
||||
|
||||
method_dtable[method.name] = method;
|
||||
}
|
||||
}
|
||||
|
||||
GLOBAL(protocol_copyMethodDescriptionList) = function(/*Protocol*/ proto, /*BOOL*/ isRequiredMethod, /*BOOL*/ isInstanceMethod)
|
||||
{
|
||||
if (!isRequiredMethod)
|
||||
return [];
|
||||
|
||||
var method_dtable = isInstanceMethod ? proto.instance_methods : proto.class_methods,
|
||||
methodList = [];
|
||||
|
||||
for (var selector in method_dtable)
|
||||
if (method_dtable.hasOwnProperty(selector))
|
||||
methodList.push(method_dtable[selector]);
|
||||
|
||||
return methodList;
|
||||
}
|
||||
|
||||
GLOBAL(protocol_addProtocol) = function(/*Protocol*/ proto, /*Protocol*/ addition)
|
||||
{
|
||||
if (!proto || !addition) return;
|
||||
|
||||
(proto.protocol_list || (proto.protocol_list = [])).push(addition);
|
||||
}
|
||||
|
||||
var _class_initialize = function(/*Class*/ aClass)
|
||||
{
|
||||
var meta = GETMETA(aClass);
|
||||
@@ -442,6 +594,7 @@ GLOBAL(objj_resetRegisterClasses) = function()
|
||||
delete global[key];
|
||||
|
||||
REGISTERED_CLASSES = {};
|
||||
REGISTERED_PROTOCOLS = {};
|
||||
|
||||
resetBundle();
|
||||
}
|
||||
@@ -567,6 +720,13 @@ GLOBAL(objj_getMetaClass) = function(/*String*/ aName)
|
||||
return GETMETA(theClass);
|
||||
}
|
||||
|
||||
// Working with Protocol
|
||||
|
||||
GLOBAL(objj_getProtocol) = function(/*String*/ aName)
|
||||
{
|
||||
return REGISTERED_PROTOCOLS[aName];
|
||||
}
|
||||
|
||||
// Working with Instance Variables
|
||||
|
||||
GLOBAL(ivar_getName) = function(anIvar)
|
||||
|
||||
+256
-100
@@ -373,12 +373,15 @@ if (typeof exports != "undefined" && !exports.acorn) {
|
||||
var _action = {keyword: "action"}, _selector = {keyword: "selector"}, _class = {keyword: "class"}, _global = {keyword: "global"};
|
||||
var _dictionaryLiteral = {keyword: "{"}, _arrayLiteral = {keyword: "["};
|
||||
var _ref = {keyword: "ref"}, _deref = {keyword: "deref"};
|
||||
var _protocol = {keyword: "protocol"}, _optional = {keyword: "optional"}, _required = {keyword: "required"};
|
||||
var _interface = {keyword: "interface"};
|
||||
|
||||
// Objective-J keywords
|
||||
|
||||
var _filename = {keyword: "filename"}, _unsigned = {keyword: "unsigned", okAsIdent: true}, _signed = {keyword: "signed", okAsIdent: true};
|
||||
var _byte = {keyword: "byte", okAsIdent: true}, _char = {keyword: "char", okAsIdent: true}, _short = {keyword: "short", okAsIdent: true};
|
||||
var _int = {keyword: "int", okAsIdent: true}, _long = {keyword: "long", okAsIdent: true}, _preprocess = {keyword: "#"};
|
||||
var _int = {keyword: "int", okAsIdent: true}, _long = {keyword: "long", okAsIdent: true}, _id = {keyword: "id", okAsIdent: true};
|
||||
var _preprocess = {keyword: "#"};
|
||||
|
||||
// Preprocessor keywords
|
||||
|
||||
@@ -412,13 +415,14 @@ if (typeof exports != "undefined" && !exports.acorn) {
|
||||
// Map Objective-J keyword names to token types.
|
||||
|
||||
var keywordTypesObjJ = {"IBAction": _action, "IBOutlet": _outlet, "unsigned": _unsigned, "signed": _signed, "byte": _byte, "char": _char,
|
||||
"short": _short, "int": _int, "long": _long };
|
||||
"short": _short, "int": _int, "long": _long, "id": _id };
|
||||
|
||||
// Map Objective-J "@" keyword names to token types.
|
||||
|
||||
var objJAtKeywordTypes = {"implementation": _implementation, "outlet": _outlet, "accessors": _accessors, "end": _end,
|
||||
"import": _import, "action": _action, "selector": _selector, "class": _class, "global": _global,
|
||||
"ref": _ref, "deref": _deref};
|
||||
"ref": _ref, "deref": _deref, "protocol": _protocol, "optional": _optional, "required": _required,
|
||||
"interface": _interface};
|
||||
|
||||
// Map Preprocessor keyword names to token types.
|
||||
|
||||
@@ -543,7 +547,7 @@ if (typeof exports != "undefined" && !exports.acorn) {
|
||||
|
||||
// The Objective-J keywords.
|
||||
|
||||
var isKeywordObjJ = makePredicate("IBAction IBOutlet byte char short int long unsigned signed");
|
||||
var isKeywordObjJ = makePredicate("IBAction IBOutlet byte char short int long unsigned signed id");
|
||||
|
||||
// The preprocessor keywords.
|
||||
|
||||
@@ -2102,6 +2106,47 @@ var preIfLevel = 0;
|
||||
next();
|
||||
return finishNode(node, "EmptyStatement");
|
||||
|
||||
// This is a Objective-J statement
|
||||
case _interface:
|
||||
if (options.objj) {
|
||||
next();
|
||||
node.classname = parseIdent(true);
|
||||
if (eat(_colon))
|
||||
node.superclassname = parseIdent(true);
|
||||
else if (eat(_parenL)) {
|
||||
node.categoryname = parseIdent(true);
|
||||
expect(_parenR, "Expected closing ')' after category name");
|
||||
}
|
||||
if (tokVal === '<') {
|
||||
next();
|
||||
var protocols = [],
|
||||
first = true;
|
||||
node.protocols = protocols;
|
||||
while (tokVal !== '>') {
|
||||
if (!first)
|
||||
expect(_comma, "Expected ',' between protocol names");
|
||||
else first = false;
|
||||
protocols.push(parseIdent(true));
|
||||
}
|
||||
next();
|
||||
}
|
||||
if (eat(_braceL)) {
|
||||
node.ivardeclarations = [];
|
||||
for (;;) {
|
||||
if (eat(_braceR)) break;
|
||||
parseIvarDeclaration(node);
|
||||
}
|
||||
node.endOfIvars = tokStart;
|
||||
}
|
||||
node.body = [];
|
||||
while(!eat(_end)) {
|
||||
if (tokType === _eof) raise(tokPos, "Expected '@end' after '@interface'");
|
||||
node.body.push(parseClassElement());
|
||||
}
|
||||
return finishNode(node, "InterfaceDeclarationStatement");
|
||||
}
|
||||
break;
|
||||
|
||||
// This is a Objective-J statement
|
||||
case _implementation:
|
||||
if (options.objj) {
|
||||
@@ -2113,6 +2158,32 @@ var preIfLevel = 0;
|
||||
node.categoryname = parseIdent(true);
|
||||
expect(_parenR, "Expected closing ')' after category name");
|
||||
}
|
||||
if (tokVal === '<') {
|
||||
next();
|
||||
var protocols = [],
|
||||
first = true;
|
||||
node.protocols = protocols;
|
||||
while (tokVal !== '>') {
|
||||
if (!first)
|
||||
expect(_comma, "Expected ',' between protocol names");
|
||||
else first = false;
|
||||
protocols.push(parseIdent(true));
|
||||
}
|
||||
next();
|
||||
}
|
||||
if (tokVal === '<') {
|
||||
next();
|
||||
var protocols = [],
|
||||
first = true;
|
||||
node.protocols = protocols;
|
||||
while (tokVal !== '>') {
|
||||
if (!first)
|
||||
expect(_comma, "Expected ',' between protocol names");
|
||||
else first = false;
|
||||
protocols.push(parseIdent(true));
|
||||
}
|
||||
next();
|
||||
}
|
||||
if (eat(_braceL)) {
|
||||
node.ivardeclarations = [];
|
||||
for (;;) {
|
||||
@@ -2126,38 +2197,90 @@ var preIfLevel = 0;
|
||||
if (tokType === _eof) raise(tokPos, "Expected '@end' after '@implementation'");
|
||||
node.body.push(parseClassElement());
|
||||
}
|
||||
return finishNode(node, "ClassDeclarationStatement");
|
||||
}
|
||||
return finishNode(node, "ClassDeclarationStatement");
|
||||
break;
|
||||
|
||||
// This is a Objective-J statement
|
||||
case _protocol:
|
||||
// If next token is a left parenthesis it is a ProtocolLiternal expression so bail out
|
||||
if (options.objj && input.charCodeAt(tokPos) !== 40) { // '('
|
||||
next();
|
||||
node.protocolname = parseIdent(true);
|
||||
if (tokVal === '<') {
|
||||
next();
|
||||
var protocols = [],
|
||||
first = true;
|
||||
node.protocols = protocols;
|
||||
while (tokVal !== '>') {
|
||||
if (!first)
|
||||
expect(_comma, "Expected ',' between protocol names");
|
||||
else first = false;
|
||||
protocols.push(parseIdent(true));
|
||||
}
|
||||
next();
|
||||
}
|
||||
while(!eat(_end)) {
|
||||
if (tokType === _eof) raise(tokPos, "Expected '@end' after '@protocol'");
|
||||
if (eat(_required)) continue;
|
||||
if (eat(_optional)) {
|
||||
while(!eat(_required) && tokType !== _end) {
|
||||
(node.optional || (node.optional = [])).push(parseProtocolClassElement());
|
||||
}
|
||||
} else {
|
||||
(node.required || (node.required = [])).push(parseProtocolClassElement());
|
||||
}
|
||||
}
|
||||
return finishNode(node, "ProtocolDeclarationStatement");
|
||||
}
|
||||
break;
|
||||
|
||||
// This is a Objective-J statement
|
||||
case _import:
|
||||
next();
|
||||
if (tokType === _string)
|
||||
node.localfilepath = true;
|
||||
else if (tokType ===_filename)
|
||||
node.localfilepath = false;
|
||||
else
|
||||
unexpected();
|
||||
if (options.objj) {
|
||||
next();
|
||||
if (tokType === _string)
|
||||
node.localfilepath = true;
|
||||
else if (tokType ===_filename)
|
||||
node.localfilepath = false;
|
||||
else
|
||||
unexpected();
|
||||
|
||||
node.filename = parseStringNumRegExpLiteral();
|
||||
return finishNode(node, "ImportStatement");
|
||||
node.filename = parseStringNumRegExpLiteral();
|
||||
return finishNode(node, "ImportStatement");
|
||||
}
|
||||
break;
|
||||
|
||||
// This is a Objective-J statement
|
||||
case _preprocess:
|
||||
next();
|
||||
return finishNode(node, "PreprocessStatement");
|
||||
if (options.objj) {
|
||||
next();
|
||||
return finishNode(node, "PreprocessStatement");
|
||||
}
|
||||
break;
|
||||
|
||||
// This is a Objective-J statement
|
||||
case _class:
|
||||
next();
|
||||
node.id = parseIdent(false);
|
||||
return finishNode(node, "ClassStatement");
|
||||
if (options.objj) {
|
||||
next();
|
||||
node.id = parseIdent(false);
|
||||
return finishNode(node, "ClassStatement");
|
||||
}
|
||||
break;
|
||||
|
||||
// This is a Objective-J statement
|
||||
case _global:
|
||||
next();
|
||||
node.id = parseIdent(false);
|
||||
return finishNode(node, "GlobalStatement");
|
||||
if (options.objj) {
|
||||
next();
|
||||
node.id = parseIdent(false);
|
||||
return finishNode(node, "GlobalStatement");
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// The indentation is one step to the right here to make sure it
|
||||
// is the same as in the original acorn parser. Easier merge
|
||||
|
||||
// If the statement does not start with a statement keyword or a
|
||||
// brace, it's an ExpressionStatement or LabeledStatement. We
|
||||
@@ -2165,7 +2288,6 @@ var preIfLevel = 0;
|
||||
// next token is a colon and the expression was a simple
|
||||
// Identifier node, we switch to interpreting it as a label.
|
||||
|
||||
default:
|
||||
var maybeName = tokVal, expr = parseExpression();
|
||||
if (starttype === _name && expr.type === "Identifier" && eat(_colon)) {
|
||||
for (var i = 0; i < labels.length; ++i)
|
||||
@@ -2181,18 +2303,8 @@ var preIfLevel = 0;
|
||||
semicolon();
|
||||
return finishNode(node, "ExpressionStatement");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CompoundIvarDeclaration =
|
||||
// IvarType _ IvarDeclaration (_ "," _ IvarDeclaration)* EOS
|
||||
|
||||
// IvarDeclaration =
|
||||
// Identifier _ Accessors?
|
||||
|
||||
// Accessors =
|
||||
// "@accessors" ("(" (AccessorsConfiguration (_ "," _ AccessorsConfiguration)*)? ")")?
|
||||
|
||||
function parseIvarDeclaration(node) {
|
||||
var outlet;
|
||||
if (eat(_outlet))
|
||||
@@ -2252,49 +2364,56 @@ var preIfLevel = 0;
|
||||
semicolon();
|
||||
}
|
||||
|
||||
function parseClassElement() {
|
||||
var methodType = tokVal,
|
||||
element = startNode();
|
||||
if (eat(_plusmin)) {
|
||||
element.methodtype = methodType;
|
||||
// If we find a '(' we have a return type to parse
|
||||
function parseMethodDeclaration(node) {
|
||||
node.methodtype = tokVal;
|
||||
expect(_plusmin, "Method declaration must start with '+' or '-'");
|
||||
// If we find a '(' we have a return type to parse
|
||||
if (eat(_parenL)) {
|
||||
var typeNode = startNode();
|
||||
if (eat(_action)) {
|
||||
node.action = finishNode(typeNode, "ObjectiveJActionType");
|
||||
typeNode = startNode();
|
||||
}
|
||||
if (!eat(_parenR)) {
|
||||
node.returntype = parseObjectiveJType(typeNode);
|
||||
expect(_parenR, "Expected closing ')' after method return type");
|
||||
}
|
||||
}
|
||||
// Now we parse the selector
|
||||
var first = true,
|
||||
selectors = [],
|
||||
args = [];
|
||||
node.selectors = selectors;
|
||||
node.arguments = args;
|
||||
for (;;) {
|
||||
if (tokType !== _colon) {
|
||||
selectors.push(parseIdent(true));
|
||||
if (first && tokType !== _colon) break;
|
||||
} else
|
||||
selectors.push(null);
|
||||
expect(_colon, "Expected ':' in selector");
|
||||
var argument = {};
|
||||
args.push(argument);
|
||||
if (eat(_parenL)) {
|
||||
if (eat(_action))
|
||||
element.action = true;
|
||||
if (!eat(_parenR)) {
|
||||
element.returntype = parseObjectiveJType();
|
||||
expect(_parenR, "Expected closing ')' after method return type");
|
||||
}
|
||||
argument.type = parseObjectiveJType();
|
||||
expect(_parenR, "Expected closing ')' after method argument type");
|
||||
}
|
||||
// Now we parse the selector
|
||||
var first = true,
|
||||
selectors = [],
|
||||
args = [];
|
||||
element.selectors = selectors;
|
||||
element.arguments = args;
|
||||
for (;;) {
|
||||
if (tokType !== _colon) {
|
||||
selectors.push(parseIdent(true));
|
||||
if (first && tokType !== _colon) break;
|
||||
} else
|
||||
selectors.push(null);
|
||||
expect(_colon, "Expected ':' in selector");
|
||||
var argument = {};
|
||||
args.push(argument);
|
||||
if (eat(_parenL)) {
|
||||
argument.type = parseObjectiveJType();
|
||||
expect(_parenR, "Expected closing ')' after method argument type");
|
||||
}
|
||||
argument.identifier = parseIdent(false);
|
||||
if (tokType === _braceL || eat(_semi)) break;
|
||||
if (eat(_comma)) {
|
||||
expect(_dotdotdot, "Expected '...' after ',' in method declaration");
|
||||
element.parameters = true;
|
||||
break;
|
||||
}
|
||||
first = false;
|
||||
argument.identifier = parseIdent(false);
|
||||
if (tokType === _braceL || tokType === _semi) break;
|
||||
if (eat(_comma)) {
|
||||
expect(_dotdotdot, "Expected '...' after ',' in method declaration");
|
||||
node.parameters = true;
|
||||
break;
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
function parseClassElement() {
|
||||
var element = startNode();
|
||||
if (tokVal === '+' || tokVal === '-') {
|
||||
parseMethodDeclaration(element);
|
||||
eat(_semi);
|
||||
element.startOfBody = lastEnd;
|
||||
// Start a new scope with regard to labels and the `inFunction`
|
||||
// flag (restore them to their old value afterwards).
|
||||
@@ -2307,6 +2426,14 @@ var preIfLevel = 0;
|
||||
return parseStatement();
|
||||
}
|
||||
|
||||
function parseProtocolClassElement() {
|
||||
var element = startNode();
|
||||
parseMethodDeclaration(element);
|
||||
|
||||
semicolon();
|
||||
return finishNode(element, "MethodDeclarationStatement");
|
||||
}
|
||||
|
||||
// Used for constructs like `switch` and `if` that insist on
|
||||
// parentheses around their expression.
|
||||
|
||||
@@ -2622,6 +2749,14 @@ var preIfLevel = 0;
|
||||
expect(_parenR, "Expected closing ')' after selector");
|
||||
return finishNode(node, "SelectorLiteralExpression");
|
||||
|
||||
case _protocol:
|
||||
var node = startNode();
|
||||
next();
|
||||
expect(_parenL, "Expected '(' after '@protocol'");
|
||||
node.id = parseIdent(true);
|
||||
expect(_parenR, "Expected closing ')' after protocol name");
|
||||
return finishNode(node, "ProtocolLiteralExpression");
|
||||
|
||||
case _ref:
|
||||
var node = startNode();
|
||||
next();
|
||||
@@ -2639,6 +2774,9 @@ var preIfLevel = 0;
|
||||
return finishNode(node, "Dereference");
|
||||
|
||||
default:
|
||||
if(tokType.okAsIdent)
|
||||
return parseIdent();
|
||||
|
||||
unexpected();
|
||||
}
|
||||
}
|
||||
@@ -2869,51 +3007,69 @@ var preIfLevel = 0;
|
||||
}
|
||||
|
||||
// Parse the next token as an Objective-J typ.
|
||||
// It can be an identifier followed by a optional protocol '<CPKeyValueBinding>'
|
||||
// It can be 'void'
|
||||
// It can be 'id' followed by a optional protocol '<CPKeyValueBinding, ...>'
|
||||
// It can be 'void' or 'id'
|
||||
// It can be 'signed' or 'unsigned' followed by an optional 'char', 'byte', 'short', 'int' or 'long'
|
||||
// It can be 'char', 'byte', 'short', 'int' or 'long'
|
||||
// 'int' can be followed by an optinal 'long'. 'long' can be followed by an optional extra 'long'
|
||||
|
||||
function parseObjectiveJType() {
|
||||
var node = startNode();
|
||||
function parseObjectiveJType(startFrom) {
|
||||
var node = startFrom ? startNodeFrom(startFrom) : startNode();
|
||||
if (tokType === _name) {
|
||||
// It should be a class name
|
||||
node.name = tokVal;
|
||||
node.typeisclass = true;
|
||||
next();
|
||||
if (tokVal === '<') {
|
||||
next();
|
||||
node.protocol = parseIdent(true);
|
||||
if (tokVal !== '>') unexpected();
|
||||
next();
|
||||
}
|
||||
} else {
|
||||
node.name = tokType.keyword;
|
||||
// Do nothing more if it is 'void'
|
||||
if (!eat(_void)) {
|
||||
var nextKeyWord;
|
||||
if (eat(_signed) || eat(_unsigned))
|
||||
nextKeyWord = tokType.keyword || true;
|
||||
if (eat(_char) || eat(_byte) || eat(_short)) {
|
||||
if (nextKeyWord)
|
||||
node.name += " " + nextKeyWord;
|
||||
nextKeyWord = tokType.keyword || true;
|
||||
} else {
|
||||
if (eat(_int)) {
|
||||
if (nextKeyWord)
|
||||
node.name += " " + nextKeyWord;
|
||||
nextKeyWord = tokType.keyword || true;
|
||||
if (eat(_id)) {
|
||||
// Is it 'id' followed by a '<' parse protocols. Do nothing more if it is only 'id'
|
||||
if (tokVal === '<') {
|
||||
var first = true,
|
||||
protocols = [];
|
||||
node.protocols = protocols;
|
||||
do {
|
||||
next();
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
eat(_comma);
|
||||
protocols.push(parseIdent(true));
|
||||
} while (tokVal !== '>');
|
||||
next();
|
||||
}
|
||||
if (eat(_long)) {
|
||||
} else {
|
||||
// Now check if it is some basic type or an approved combination of basic types
|
||||
var nextKeyWord;
|
||||
if (eat(_signed) || eat(_unsigned))
|
||||
nextKeyWord = tokType.keyword || true;
|
||||
if (eat(_char) || eat(_byte) || eat(_short)) {
|
||||
if (nextKeyWord)
|
||||
node.name += " " + nextKeyWord;
|
||||
nextKeyWord = tokType.keyword || true;
|
||||
} else {
|
||||
if (eat(_int)) {
|
||||
if (nextKeyWord)
|
||||
node.name += " " + nextKeyWord;
|
||||
nextKeyWord = tokType.keyword || true;
|
||||
}
|
||||
if (eat(_long)) {
|
||||
node.name += " " + nextKeyWord;
|
||||
if (nextKeyWord)
|
||||
node.name += " " + nextKeyWord;
|
||||
nextKeyWord = tokType.keyword || true;
|
||||
if (eat(_long)) {
|
||||
node.name += " " + nextKeyWord;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!nextKeyWord) {
|
||||
node.name = (!options.forbidReserved && tokType.keyword) || unexpected();
|
||||
next();
|
||||
if (!nextKeyWord) {
|
||||
// It must be a class name if it was not a basic type. // FIXME: This is not true
|
||||
node.name = (!options.forbidReserved && tokType.keyword) || unexpected();
|
||||
node.typeisclass = true;
|
||||
next();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,14 +208,23 @@ if (!exports.acorn) {
|
||||
|
||||
exports.IvarDeclaration = ignore;
|
||||
|
||||
exports.MethodDeclarationStatement = ignore;
|
||||
|
||||
exports.PreprocessStatement = ignore;
|
||||
exports.ClassStatement = ignore;
|
||||
exports.GlobalStatement = ignore;
|
||||
|
||||
exports.ProtocolDeclarationStatement = function(node, st, c) {
|
||||
if (node.required) for (var i = 0; i < node.required.length; ++i) {
|
||||
c(node.required[i], st, "Statement");
|
||||
}
|
||||
if (node.optional) for (var i = 0; i < node.optional.length; ++i) {
|
||||
c(node.optional[i], st, "Statement");
|
||||
}
|
||||
}
|
||||
|
||||
exports.MethodDeclarationStatement = function(node, st, c) {
|
||||
c(node.body, st, "Statement");
|
||||
var body = node.body;
|
||||
if (body)
|
||||
c(body, st, "Statement");
|
||||
}
|
||||
|
||||
exports.MessageSendExpression = function(node, st, c) {
|
||||
@@ -227,6 +236,7 @@ if (!exports.acorn) {
|
||||
}
|
||||
|
||||
exports.SelectorLiteralExpression = ignore;
|
||||
exports.ProtocolLiteralExpression = ignore;
|
||||
|
||||
exports.Reference = function(node, st, c) {
|
||||
c(node.element, st, "Identifier");
|
||||
|
||||
@@ -1079,22 +1079,22 @@
|
||||
return [_contentArray count];
|
||||
}
|
||||
|
||||
- (id)objectInItemsArrayAtIndex:(unsigned int)index
|
||||
- (id)objectInItemsArrayAtIndex:(CPUInteger)index
|
||||
{
|
||||
return [_contentArray objectAtIndex:index];
|
||||
}
|
||||
|
||||
- (void)insertObject:(id)anObject inItemsArrayAtIndex:(unsigned int)index
|
||||
- (void)insertObject:(id)anObject inItemsArrayAtIndex:(CPUInteger)index
|
||||
{
|
||||
[_contentArray insertObject:anObject atIndex:index];
|
||||
}
|
||||
|
||||
- (void)removeObjectFromItemsArrayAtIndex:(unsigned int)index
|
||||
- (void)removeObjectFromItemsArrayAtIndex:(CPUInteger)index
|
||||
{
|
||||
[_contentArray removeObjectAtIndex:index];
|
||||
}
|
||||
|
||||
- (void)replaceObjectInItemsArrayAtIndex:(unsigned int)index withObject:(id)anObject
|
||||
- (void)replaceObjectInItemsArrayAtIndex:(CPUInteger)index withObject:(id)anObject
|
||||
{
|
||||
[_contentArray replaceObjectAtIndex:index withObject:anObject];
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@
|
||||
id lastKey;
|
||||
}
|
||||
|
||||
- (void)setValue:value forKey:aKey
|
||||
- (void)setValue:(id)value forKey:(CPString)aKey
|
||||
{
|
||||
lastValue = value;
|
||||
lastKey = aKey;
|
||||
|
||||
@@ -327,12 +327,12 @@
|
||||
return [tableEntries count];
|
||||
}
|
||||
|
||||
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow
|
||||
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow
|
||||
{
|
||||
return tableEntries[aRow];
|
||||
}
|
||||
|
||||
- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(int)aRow
|
||||
- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow
|
||||
{
|
||||
tableEntries[aRow] = anObject;
|
||||
}
|
||||
@@ -343,7 +343,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(int)anRow
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)anRow
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
@@ -357,7 +357,7 @@
|
||||
CPTableViewTest tester @accessors;
|
||||
}
|
||||
|
||||
- (void)tableView:(CPTableView)aTableView willDisplayView:(CPView)aView forTableColumn:(CPTableColumn)tableColumn row:(int)row
|
||||
- (void)tableView:(CPTableView)aTableView willDisplayView:(CPView)aView forTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row
|
||||
{
|
||||
// Make sure each view contains the full row in its objectValue
|
||||
[tester assert:tableEntries[row] equals:[aView objectValue]];
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
}
|
||||
|
||||
- (id)initWithFrame:aFrame
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
if (self = [super initWithFrame:aFrame])
|
||||
{
|
||||
|
||||
+4
-4
@@ -32,7 +32,7 @@
|
||||
return [collection count];
|
||||
}
|
||||
|
||||
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex
|
||||
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex
|
||||
{
|
||||
var objectAtRow = [collection objectAtIndex:rowIndex],
|
||||
columnKey = [aTableColumn identifier];
|
||||
@@ -40,7 +40,7 @@
|
||||
return [objectAtRow valueForKey:columnKey];
|
||||
}
|
||||
|
||||
- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex
|
||||
- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex
|
||||
{
|
||||
var objectAtRow = [collection objectAtIndex:rowIndex],
|
||||
columnKey = [aTableColumn identifier];
|
||||
@@ -56,8 +56,8 @@
|
||||
// TODO Drag and drop is not implemented since it's difficult to test in a unit test and not all that relevant in a bindings context anyhow.
|
||||
|
||||
// - (BOOL)tableView:(CPTableView)aTableView writeRowsWithIndexes:(CPIndexSet)rowIndexes toPasteboard:(CPPasteboard)pboard
|
||||
// - (CPDragOperation)tableView:(CPTableView)tv validateDrop:(id)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)op
|
||||
// - (BOOL)tableView:(CPTableView)tv acceptDrop:(id)info row:(int)row dropOperation:(CPTableViewDropOperation)op
|
||||
// - (CPDragOperation)tableView:(CPTableView)tv validateDrop:(id)info proposedRow:(CPInteger)row proposedDropOperation:(CPTableViewDropOperation)op
|
||||
// - (BOOL)tableView:(CPTableView)tv acceptDrop:(id)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)op
|
||||
// - (void)awakeFromNib
|
||||
|
||||
@end
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@
|
||||
// TODO Drag and drop is not implemented since it's difficult to test in a unit test and not all that relevant in a bindings context anyhow.
|
||||
|
||||
// - (BOOL)tableView:(CPTableView)aTableView writeRowsWithIndexes:(CPIndexSet)rowIndexes toPasteboard:(CPPasteboard)pboard
|
||||
// - (CPDragOperation)tableView:(CPTableView)tv validateDrop:(id)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)op
|
||||
// - (BOOL)tableView:(CPTableView)tv acceptDrop:(id)info row:(int)row dropOperation:(CPTableViewDropOperation)op
|
||||
// - (CPDragOperation)tableView:(CPTableView)tv validateDrop:(id)info proposedRow:(CPInteger)row proposedDropOperation:(CPTableViewDropOperation)op
|
||||
// - (BOOL)tableView:(CPTableView)tv acceptDrop:(id)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)op
|
||||
// - (void)awakeFromNib
|
||||
|
||||
@end
|
||||
|
||||
@@ -116,7 +116,7 @@ var sharedObject = [CPObject new];
|
||||
testAttributesAtIndexWithValues(string, 33, expectedValues, self);
|
||||
}
|
||||
|
||||
//- (CPDictionary)attributesAtIndex:(unsigned)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit
|
||||
//- (CPDictionary)attributesAtIndex:(CPUInteger)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit
|
||||
- (void)testAttributesAtIndexLongestEffectiveRangeInRange
|
||||
{
|
||||
var string = [self stringForTesting];
|
||||
@@ -135,7 +135,7 @@ var sharedObject = [CPObject new];
|
||||
[self assertTrue:[attributes objectForKey:"f"] === 43 message:@"expecting 'f' to be 43, was: " + [attributes objectForKey:"f"]];
|
||||
}
|
||||
|
||||
//- (id)attribute:(CPString)attribute atIndex:(unsigned)index effectiveRange:(CPRangePointer)aRange
|
||||
//- (id)attribute:(CPString)attribute atIndex:(CPUInteger)index effectiveRange:(CPRangePointer)aRange
|
||||
- (void)testAttributeAtIndexEffectiveRange
|
||||
{
|
||||
var string = [self stringForTesting];
|
||||
@@ -144,7 +144,7 @@ var sharedObject = [CPObject new];
|
||||
testAttributeAtIndexWithValue(string, 20, "d", [CPNull null], self);
|
||||
}
|
||||
|
||||
//- (id)attribute:(CPString)attribute atIndex:(unsigned)index longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit
|
||||
//- (id)attribute:(CPString)attribute atIndex:(CPUInteger)index longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit
|
||||
- (void)testAttributeAtIndexLongestEffectiveRangeInRange
|
||||
{
|
||||
var string = [self stringForTesting];
|
||||
|
||||
@@ -833,17 +833,17 @@
|
||||
return [managedObjects count];
|
||||
}
|
||||
|
||||
- (id)objectInManagedObjectsAtIndex:(unsigned)anIndex
|
||||
- (id)objectInManagedObjectsAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
return [managedObjects objectAtIndex:anIndex];
|
||||
}
|
||||
|
||||
- (void)removeObjectFromManagedObjectsAtIndex:(unsigned)anIndex
|
||||
- (void)removeObjectFromManagedObjectsAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
[managedObjects removeObjectAtIndex:anIndex];
|
||||
}
|
||||
|
||||
- (void)insertObject:(id)anObject inManagedObjectsAtIndex:(unsigned)anIndex
|
||||
- (void)insertObject:(id)anObject inManagedObjectsAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
[managedObjects insertObject:anObject atIndex:anIndex];
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ globalResults = [];
|
||||
- (void)observeValueForKeyPath:(CPString)keyPath
|
||||
ofObject:(id)object
|
||||
change:(CPDictionary)change
|
||||
context:(void)context
|
||||
context:(id)context
|
||||
{
|
||||
[changedKeyPaths addObject:keyPath];
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
- (void)observeValueForKeyPath:(CPString)keyPath
|
||||
ofObject:(id)object
|
||||
change:(CPDictionary)change
|
||||
context:(void)context
|
||||
context:(id)context
|
||||
{
|
||||
[changedKeyPaths addObject:keyPath];
|
||||
}
|
||||
|
||||
@@ -75,13 +75,13 @@ CPLogRegister(CPLogConsole);
|
||||
return [itemsArray count];
|
||||
}
|
||||
|
||||
- (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(int)row
|
||||
- (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row
|
||||
{
|
||||
return "foo";
|
||||
}
|
||||
*/
|
||||
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
@@ -134,22 +134,22 @@ CPLogRegister(CPLogConsole);
|
||||
return [itemsArray count];
|
||||
}
|
||||
|
||||
- (id)objectInItemsArrayAtIndex:(unsigned int)index
|
||||
- (id)objectInItemsArrayAtIndex:(CPUInteger)index
|
||||
{
|
||||
return [itemsArray objectAtIndex:index];
|
||||
}
|
||||
|
||||
- (void)insertObject:(id)anObject inItemsArrayAtIndex:(unsigned int)index
|
||||
- (void)insertObject:(id)anObject inItemsArrayAtIndex:(CPUInteger)index
|
||||
{
|
||||
[itemsArray insertObject:anObject atIndex:index];
|
||||
}
|
||||
|
||||
- (void)removeObjectFromItemsArrayAtIndex:(unsigned int)index
|
||||
- (void)removeObjectFromItemsArrayAtIndex:(CPUInteger)index
|
||||
{
|
||||
[itemsArray removeObjectAtIndex:index];
|
||||
}
|
||||
|
||||
- (void)replaceObjectInItemsArrayAtIndex:(unsigned int)index withObject:(id)anObject
|
||||
- (void)replaceObjectInItemsArrayAtIndex:(CPUInteger)index withObject:(id)anObject
|
||||
{
|
||||
[itemsArray replaceObjectAtIndex:index withObject:anObject];
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
//[browser setAllowsMultipleSelection:NO];
|
||||
}
|
||||
|
||||
- (BOOL)browser:(CPBrowser)aBrowser writeRowsWithIndexes:(CPIndexSet)indexes inColumn:(int)column toPasteboard:(CPPasteboard)pboard
|
||||
- (BOOL)browser:(CPBrowser)aBrowser writeRowsWithIndexes:(CPIndexSet)indexes inColumn:(CPInteger)column toPasteboard:(CPPasteboard)pboard
|
||||
{
|
||||
var encodedData = [CPKeyedArchiver archivedDataWithRootObject:"Foo"];
|
||||
[pboard declareTypes:["Type"] owner:self];
|
||||
@@ -85,11 +85,11 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)browser:(id)aBrowser validateDrop:(id)info proposedRow:(int)row column:(int)column dropOperation:(id)op
|
||||
- (BOOL)browser:(id)aBrowser validateDrop:(id)info proposedRow:(CPInteger)row column:(CPInteger)column dropOperation:(id)op
|
||||
{
|
||||
return CPDragOperationMove;
|
||||
}
|
||||
- (BOOL)browser:(id)aBrowser acceptDrop:(id)info atRow:(int)row column:(int)column dropOperation:(id)op
|
||||
- (BOOL)browser:(id)aBrowser acceptDrop:(id)info atRow:(CPInteger)row column:(CPInteger)column dropOperation:(id)op
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
[tableView setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(CPTableView)tableView isGroupRow:(int)row
|
||||
- (BOOL)tableView:(CPTableView)tableView isGroupRow:(CPInteger)row
|
||||
{
|
||||
return (row > 2 && row < 5);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ var CPRuleEditorCustomControlClass = @"CPRuleEditorCustomControlClass";
|
||||
(1) CPMenuItem: not implemented yet.
|
||||
*/
|
||||
|
||||
- (id)ruleEditor:(CPRuleEditor)editor displayValueForCriterion:(id)criterion inRow:(int)row
|
||||
- (id)ruleEditor:(CPRuleEditor)editor displayValueForCriterion:(id)criterion inRow:(CPInteger)row
|
||||
{
|
||||
var custom_control_class = [criterion objectForKey:CPRuleEditorCustomControlClass];
|
||||
|
||||
@@ -98,7 +98,7 @@ var CPRuleEditorCustomControlClass = @"CPRuleEditorCustomControlClass";
|
||||
return [criterion objectForKey:@"valeur"];
|
||||
}
|
||||
|
||||
- (CPDictionary)ruleEditor:(CPRuleEditor)editor predicatePartsForCriterion:(id)criterion withDisplayValue:(id)value inRow:(int)row
|
||||
- (CPDictionary)ruleEditor:(CPRuleEditor)editor predicatePartsForCriterion:(id)criterion withDisplayValue:(id)value inRow:(CPInteger)row
|
||||
{
|
||||
var predicatePartsForCriterion = @{};
|
||||
|
||||
|
||||
@@ -47,14 +47,14 @@
|
||||
return [dataSource count];
|
||||
}
|
||||
|
||||
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex
|
||||
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex
|
||||
{
|
||||
return dataSource[rowIndex];
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(int)rowIndex
|
||||
- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(CPInteger)rowIndex
|
||||
{
|
||||
return rowIndex == 5;
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user