From f9275a70afe88236fb6cbe8c90c749ccdf8bb02b Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Thu, 6 Nov 2014 10:17:05 -0800 Subject: [PATCH] FIXED: New warnings reveleaded by ivar type checking This patch fixes all new warnings --- AppKit/CPAlert.j | 97 +++--- AppKit/CPAnimation.j | 17 +- AppKit/CPApplication.j | 2 + AppKit/CPArrayController.j | 2 +- AppKit/CPBox.j | 3 + AppKit/CPButton.j | 4 +- AppKit/CPCollectionView.j | 1 + AppKit/CPColorPanel.j | 3 + AppKit/CPColorPicker.j | 2 + AppKit/CPComboBox.j | 2 +- AppKit/CPControl.j | 6 + AppKit/CPDatePicker/_CPDatePickerCalendar.j | 2 + AppKit/CPDatePicker/_CPDatePickerTextField.j | 6 +- AppKit/CPDragServer_Constants.j | 1 + AppKit/CPEvent.j | 5 + AppKit/CPImageView.j | 1 + AppKit/CPKeyValueBinding.j | 1 + AppKit/CPLevelIndicator.j | 2 + AppKit/CPMenu/_CPMenuBarWindow.j | 1 + AppKit/CPMenu/_CPMenuWindow.j | 2 + AppKit/CPMenuItem/_CPMenuItemMenuBarView.j | 1 + AppKit/CPMenuItem/_CPMenuItemStandardView.j | 3 + AppKit/CPMenuItem/_CPMenuItemView.j | 1 + AppKit/CPPasteboard.j | 3 +- AppKit/CPProgressIndicator.j | 1 + AppKit/CPRadio.j | 2 + AppKit/CPResponder.j | 1 + AppKit/CPRuleEditor/CPRuleEditor_Constants.j | 2 + AppKit/CPRuleEditor/_CPPredicateEditorTree.j | 2 + AppKit/CPRuleEditor/_CPRuleEditorViewSlice.j | 2 + .../CPRuleEditor/_CPRuleEditorViewSliceRow.j | 2 + AppKit/CPScroller.j | 2 + AppKit/CPSegmentedControl.j | 1 + AppKit/CPShadowView.j | 2 +- AppKit/CPTabView.j | 1 + AppKit/CPTabViewItem.j | 2 +- AppKit/CPTableColumn.j | 1 + AppKit/CPTableView.j | 3 +- AppKit/CPTextField.j | 1 + AppKit/CPTheme.j | 1 + AppKit/CPTokenField.j | 3 + AppKit/CPToolbar.j | 4 +- AppKit/CPView.j | 3 + AppKit/CPWebView.j | 2 +- AppKit/CPWindow/CPWindow.j | 6 + AppKit/CPWindow/CPWindow_Constants.j | 2 + AppKit/CoreGraphics/CGAffineTransform.j | 2 + AppKit/CoreGraphics/CGColorSpace.j | 2 + AppKit/CoreGraphics/CGContext.j | 1 + AppKit/CoreGraphics/CGGradient.j | 1 + AppKit/CoreGraphics/CGPath.j | 3 +- AppKit/Platform/CPPlatformWindow.j | 3 + AppKit/_CPImageAndTextView.j | 2 +- AppKit/_CPPopUpList.j | 214 ++++++------- AppKit/_CPToolbarItem.j | 1 + Foundation/CPDateFormatter.j | 2 + Foundation/CPDecimal.j | 3 + Foundation/CPDictionary.j | 66 ++-- Foundation/CPGeometry.j | 1 + Foundation/CPJSONPConnection.j | 1 + Foundation/CPNotificationCenter.j | 291 +++++++++--------- Foundation/CPNumberFormatter.j | 3 +- Foundation/CPObject.j | 4 +- .../CPPredicate/CPComparisonPredicate.j | 4 +- Foundation/CPPredicate/CPCompoundPredicate.j | 2 +- Foundation/CPRange.j | 2 + Foundation/CPURLConnection.j | 2 + Foundation/CPUndoManager.j | 2 +- Foundation/CPUserSessionManager.j | 1 + Foundation/_CGGeometry.j | 6 + Foundation/_CPTypeDefinitions.j | 30 ++ 71 files changed, 496 insertions(+), 367 deletions(-) create mode 100644 Foundation/_CPTypeDefinitions.j diff --git a/AppKit/CPAlert.j b/AppKit/CPAlert.j index cbd40cfe6..2dec01211 100644 --- a/AppKit/CPAlert.j +++ b/AppKit/CPAlert.j @@ -44,6 +44,7 @@ var CPAlertDelegate_alertShowHelp_ = 1 << 0, CPAlertDelegate_alertDidEnd_returnCode_ = 1 << 1; +@typedef CPAlertStyle /* @global @group CPAlertStyle @@ -70,6 +71,54 @@ var bottomHeight = 71; @end + +@implementation _CPAlertThemeView : CPView + ++ (CPString)defaultThemeClass +{ + return @"alert"; +} + ++ (CPDictionary)themeAttributes +{ + return @{ + @"size": CGSizeMake(400.0, 110.0), + @"content-inset": CGInsetMake(15, 15, 15, 50), + @"informative-offset": 6, + @"button-offset": 10, + @"message-text-alignment": CPJustifiedTextAlignment, + @"message-text-color": [CPColor blackColor], + @"message-text-font": [CPFont boldSystemFontOfSize:13.0], + @"message-text-shadow-color": [CPNull null], + @"message-text-shadow-offset": CGSizeMakeZero(), + @"informative-text-alignment": CPJustifiedTextAlignment, + @"informative-text-color": [CPColor blackColor], + @"informative-text-font": [CPFont systemFontOfSize:12.0], + @"informative-text-shadow-color": [CPNull null], + @"informative-text-shadow-offset": CGSizeMakeZero(), + @"image-offset": CGPointMake(15, 12), + @"information-image": [CPNull null], + @"warning-image": [CPNull null], + @"error-image": [CPNull null], + @"help-image": [CPNull null], + @"help-image-left-offset": 15, + @"help-image-pressed": [CPNull null], + @"suppression-button-y-offset": 0.0, + @"suppression-button-x-offset": 0.0, + @"default-elements-margin": 3.0, + @"suppression-button-text-color": [CPColor blackColor], + @"suppression-button-text-font": [CPFont systemFontOfSize:12.0], + @"suppression-button-text-shadow-color": [CPNull null], + @"suppression-button-text-shadow-offset": 0.0, + @"modal-window-button-margin-y": 0.0, + @"modal-window-button-margin-x": 0.0, + @"standard-window-button-margin-y": 0.0, + @"standard-window-button-margin-x": 0.0, + }; +} + +@end + /*! @ingroup appkit @@ -813,51 +862,3 @@ var bottomHeight = 71; } @end - - -@implementation _CPAlertThemeView : CPView - -+ (CPString)defaultThemeClass -{ - return @"alert"; -} - -+ (CPDictionary)themeAttributes -{ - return @{ - @"size": CGSizeMake(400.0, 110.0), - @"content-inset": CGInsetMake(15, 15, 15, 50), - @"informative-offset": 6, - @"button-offset": 10, - @"message-text-alignment": CPJustifiedTextAlignment, - @"message-text-color": [CPColor blackColor], - @"message-text-font": [CPFont boldSystemFontOfSize:13.0], - @"message-text-shadow-color": [CPNull null], - @"message-text-shadow-offset": CGSizeMakeZero(), - @"informative-text-alignment": CPJustifiedTextAlignment, - @"informative-text-color": [CPColor blackColor], - @"informative-text-font": [CPFont systemFontOfSize:12.0], - @"informative-text-shadow-color": [CPNull null], - @"informative-text-shadow-offset": CGSizeMakeZero(), - @"image-offset": CGPointMake(15, 12), - @"information-image": [CPNull null], - @"warning-image": [CPNull null], - @"error-image": [CPNull null], - @"help-image": [CPNull null], - @"help-image-left-offset": 15, - @"help-image-pressed": [CPNull null], - @"suppression-button-y-offset": 0.0, - @"suppression-button-x-offset": 0.0, - @"default-elements-margin": 3.0, - @"suppression-button-text-color": [CPColor blackColor], - @"suppression-button-text-font": [CPFont systemFontOfSize:12.0], - @"suppression-button-text-shadow-color": [CPNull null], - @"suppression-button-text-shadow-offset": 0.0, - @"modal-window-button-margin-y": 0.0, - @"modal-window-button-margin-x": 0.0, - @"standard-window-button-margin-y": 0.0, - @"standard-window-button-margin-x": 0.0, - }; -} - -@end diff --git a/AppKit/CPAnimation.j b/AppKit/CPAnimation.j index 903cf3c2e..bef308b74 100644 --- a/AppKit/CPAnimation.j +++ b/AppKit/CPAnimation.j @@ -42,25 +42,10 @@ var CPAnimationDelegate_animationShouldStart_ = 1 << 1, CPAnimationDelegate_animationDidEnd_ = 1 << 3, CPAnimationDelegate_animationDidStop_ = 1 << 4; -/* - @global - @group CPAnimationCurve -*/ +@typedef CPAnimationCurve CPAnimationEaseInOut = 0; -/* - @global - @group CPAnimationCurve -*/ CPAnimationEaseIn = 1; -/* - @global - @group CPAnimationCurve -*/ CPAnimationEaseOut = 2; -/* - @global - @group CPAnimationCurve -*/ CPAnimationLinear = 3; ACTUAL_FRAME_RATE = 0; diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index f3783c75a..85e57a84f 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -37,6 +37,8 @@ @import "CPWindowController.j" @import "_CPPopoverWindow.j" +@typedef CPModalSession + var CPMainCibFile = @"CPMainCibFile", CPMainCibFileHumanFriendly = @"Main cib file base name", CPEventModifierFlags = 0; diff --git a/AppKit/CPArrayController.j b/AppKit/CPArrayController.j index 0b25334d9..67e2f681e 100644 --- a/AppKit/CPArrayController.j +++ b/AppKit/CPArrayController.j @@ -23,7 +23,7 @@ */ @import - +@import @import "CPObjectController.j" @import "CPKeyValueBinding.j" diff --git a/AppKit/CPBox.j b/AppKit/CPBox.j index dc10564ff..29d0b3a08 100644 --- a/AppKit/CPBox.j +++ b/AppKit/CPBox.j @@ -24,6 +24,7 @@ @import "CPView.j" // CPBoxType +@typedef CPBoxType CPBoxPrimary = 0; CPBoxSecondary = 1; CPBoxSeparator = 2; @@ -31,12 +32,14 @@ CPBoxOldStyle = 3; CPBoxCustom = 4; // CPBorderType +@typedef CPBorderType CPNoBorder = 0; CPLineBorder = 1; CPBezelBorder = 2; CPGrooveBorder = 3; // CPTitlePosition +@typedef CPTitlePosition CPNoTitle = 0; CPAboveTop = 1; CPAtTop = 2; diff --git a/AppKit/CPButton.j b/AppKit/CPButton.j index 8365d76c7..26c17edaa 100644 --- a/AppKit/CPButton.j +++ b/AppKit/CPButton.j @@ -29,8 +29,7 @@ @import "CPWindow_Constants.j" /* @group CPBezelStyle */ - - // IB style +@typedef CPBezelStyle CPRoundedBezelStyle = 1; // Push CPRegularSquareBezelStyle = 2; // Bevel CPThickSquareBezelStyle = 3; @@ -49,6 +48,7 @@ CPHUDBezelStyle = -1; /* @group CPButtonType */ +@typedef CPButtonType CPMomentaryLightButton = 0; CPPushOnPushOffButton = 1; CPToggleButton = 2; diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index 2da7f07d9..943c05a30 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -32,6 +32,7 @@ @import "CPPasteboard.j" @import "CPView.j" +@class _CPCollectionViewDropIndicator var CPCollectionViewDelegate_collectionView_acceptDrop_index_dropOperation_ = 1 << 0, CPCollectionViewDelegate_collectionView_canDragItemsAtIndexes_withEvent_ = 1 << 1, diff --git a/AppKit/CPColorPanel.j b/AppKit/CPColorPanel.j index af6bf3e1d..7d847a30f 100644 --- a/AppKit/CPColorPanel.j +++ b/AppKit/CPColorPanel.j @@ -27,6 +27,9 @@ @import "CPView.j" @class CPSlider +@class _CPColorPanelToolbar +@class _CPColorPanelSwatches +@class _CPColorPanelPreview @global CPApp diff --git a/AppKit/CPColorPicker.j b/AppKit/CPColorPicker.j index 14aed7793..ea3afcd88 100644 --- a/AppKit/CPColorPicker.j +++ b/AppKit/CPColorPicker.j @@ -25,6 +25,8 @@ @import "CPView.j" @class CPSlider +@class CPColorPanel +@class __CPColorWheel @global CPColorPickerViewWidth @global CPColorPickerViewHeight diff --git a/AppKit/CPComboBox.j b/AppKit/CPComboBox.j index b8a4481b8..01d424664 100644 --- a/AppKit/CPComboBox.j +++ b/AppKit/CPComboBox.j @@ -63,7 +63,7 @@ var CPComboBoxTextSubview = @"text", { CPArray _items; _CPPopUpList _listDelegate; - CPComboBoxDataSource _dataSource; + id _dataSource; BOOL _usesDataSource; BOOL _completes; BOOL _canComplete; diff --git a/AppKit/CPControl.j b/AppKit/CPControl.j index c2b1083ce..c6b96ef73 100644 --- a/AppKit/CPControl.j +++ b/AppKit/CPControl.j @@ -42,16 +42,19 @@ @end +@typedef CPTextAlignment CPLeftTextAlignment = 0; CPRightTextAlignment = 1; CPCenterTextAlignment = 2; CPJustifiedTextAlignment = 3; CPNaturalTextAlignment = 4; +@typedef CPControlSize CPRegularControlSize = 0; CPSmallControlSize = 1; CPMiniControlSize = 2; +@typedef CPLineBreakMode CPLineBreakByWordWrapping = 0; CPLineBreakByCharWrapping = 1; CPLineBreakByClipping = 2; @@ -59,11 +62,13 @@ CPLineBreakByTruncatingHead = 3; CPLineBreakByTruncatingTail = 4; CPLineBreakByTruncatingMiddle = 5; +@typedef CPVerticalTextAlignment CPTopVerticalTextAlignment = 1; CPCenterVerticalTextAlignment = 2; CPBottomVerticalTextAlignment = 3; // Deprecated for use with images, use the CPImageScale constants +@typedef CPImageScaling CPScaleProportionally = 0; CPScaleToFit = 1; CPScaleNone = 2; @@ -73,6 +78,7 @@ CPImageScaleAxesIndependently = 1; CPImageScaleNone = 2; CPImageScaleProportionallyUpOrDown = 3; +@typedef CPCellImagePosition CPNoImage = 0; CPImageOnly = 1; CPImageLeft = 2; diff --git a/AppKit/CPDatePicker/_CPDatePickerCalendar.j b/AppKit/CPDatePicker/_CPDatePickerCalendar.j index 8ebd1ee8c..481bc6ba7 100644 --- a/AppKit/CPDatePicker/_CPDatePickerCalendar.j +++ b/AppKit/CPDatePicker/_CPDatePickerCalendar.j @@ -29,6 +29,8 @@ @import @class CPDatePicker +@class _CPDatePickerMonthView +@class _CPDatePickerHeaderView @global CPApp @global CPSingleDateMode diff --git a/AppKit/CPDatePicker/_CPDatePickerTextField.j b/AppKit/CPDatePicker/_CPDatePickerTextField.j index 39935b536..8fa09afce 100644 --- a/AppKit/CPDatePicker/_CPDatePickerTextField.j +++ b/AppKit/CPDatePicker/_CPDatePickerTextField.j @@ -31,6 +31,10 @@ @import @class CPDatePicker +@class _CPDatePickerElementTextField +@class _CPDatePickerElementView +@class _CPDatePickerMonthView +@class _CPDatePickerHeaderView @global CPSingleDateMode @global CPRangeDateMode @@ -1847,4 +1851,4 @@ var CPMonthDateType = 0, return CGRectMakeCopy(bounds); } -@end \ No newline at end of file +@end diff --git a/AppKit/CPDragServer_Constants.j b/AppKit/CPDragServer_Constants.j index 38ade5c31..7a347d3d4 100644 --- a/AppKit/CPDragServer_Constants.j +++ b/AppKit/CPDragServer_Constants.j @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@typedef CPDragOperation CPDragOperationNone = 0; CPDragOperationCopy = 1 << 1; CPDragOperationLink = 1 << 1; diff --git a/AppKit/CPEvent.j b/AppKit/CPEvent.j index 8dbd7b720..d0ab4e128 100644 --- a/AppKit/CPEvent.j +++ b/AppKit/CPEvent.j @@ -31,9 +31,14 @@ @import "CPText.j" @class CPTextField +@class CPWindow @global CPApp +@typedef DOMEvent +@typedef CPEventType + + var _CPEventPeriodicEventPeriod = 0, _CPEventPeriodicEventTimer = nil, _CPEventUpperCaseRegex = new RegExp("[A-Z]"), diff --git a/AppKit/CPImageView.j b/AppKit/CPImageView.j index 1c4ef8dbc..6c041fdea 100644 --- a/AppKit/CPImageView.j +++ b/AppKit/CPImageView.j @@ -29,6 +29,7 @@ @global CPImagesPboardType @global appkit_tag_dom_elements +@typedef CPImageAlignment CPImageAlignCenter = 0; CPImageAlignTop = 1; CPImageAlignTopLeft = 2; diff --git a/AppKit/CPKeyValueBinding.j b/AppKit/CPKeyValueBinding.j index 1913a4436..662280d16 100644 --- a/AppKit/CPKeyValueBinding.j +++ b/AppKit/CPKeyValueBinding.j @@ -35,6 +35,7 @@ var exposedBindingsMap = @{}, bindingsMap = @{}; +@typedef CPBindingOperationKind var CPBindingOperationAnd = 0, CPBindingOperationOr = 1; diff --git a/AppKit/CPLevelIndicator.j b/AppKit/CPLevelIndicator.j index 07ce720c3..c4e6422ee 100644 --- a/AppKit/CPLevelIndicator.j +++ b/AppKit/CPLevelIndicator.j @@ -25,11 +25,13 @@ @global CPApp +@typedef CPTickMarkPosition CPTickMarkBelow = 0; CPTickMarkAbove = 1; CPTickMarkLeft = CPTickMarkAbove; CPTickMarkRight = CPTickMarkBelow; +@typedef CPLevelIndicatorStyle CPRelevancyLevelIndicatorStyle = 0; CPContinuousCapacityLevelIndicatorStyle = 1; CPDiscreteCapacityLevelIndicatorStyle = 2; diff --git a/AppKit/CPMenu/_CPMenuBarWindow.j b/AppKit/CPMenu/_CPMenuBarWindow.j index 2c6c2bcaa..db9077b06 100644 --- a/AppKit/CPMenu/_CPMenuBarWindow.j +++ b/AppKit/CPMenu/_CPMenuBarWindow.j @@ -24,6 +24,7 @@ @import "_CPMenuManager.j" @class _CPMenuView +@class CPMenu @global CPMenuDidAddItemNotification @global CPMenuDidChangeItemNotification diff --git a/AppKit/CPMenu/_CPMenuWindow.j b/AppKit/CPMenu/_CPMenuWindow.j index ddf53a7dd..b11522d99 100644 --- a/AppKit/CPMenu/_CPMenuWindow.j +++ b/AppKit/CPMenu/_CPMenuWindow.j @@ -25,6 +25,8 @@ @import "CPWindow.j" @import "_CPMenuManager.j" +@class _CPMenuView + var _CPMenuWindowPool = [], _CPMenuWindowPoolCapacity = 5, diff --git a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j index 265b78867..e6b209f7b 100644 --- a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j +++ b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j @@ -25,6 +25,7 @@ @class _CPMenuBarWindow @class _CPMenuView +@class CPMenuItem @implementation _CPMenuItemMenuBarView : CPView { diff --git a/AppKit/CPMenuItem/_CPMenuItemStandardView.j b/AppKit/CPMenuItem/_CPMenuItemStandardView.j index 2fc534b24..f7112befb 100644 --- a/AppKit/CPMenuItem/_CPMenuItemStandardView.j +++ b/AppKit/CPMenuItem/_CPMenuItemStandardView.j @@ -24,6 +24,9 @@ @import "CPImageView.j" @import "_CPImageAndTextView.j" +@class CPMenuItem + + @implementation _CPMenuItemStandardView : CPView { CPMenuItem _menuItem @accessors(property=menuItem); diff --git a/AppKit/CPMenuItem/_CPMenuItemView.j b/AppKit/CPMenuItem/_CPMenuItemView.j index 7156db2ed..8d6b8b2cf 100644 --- a/AppKit/CPMenuItem/_CPMenuItemView.j +++ b/AppKit/CPMenuItem/_CPMenuItemView.j @@ -26,6 +26,7 @@ @import "_CPMenuItemStandardView.j" @import "_CPMenuItemMenuBarView.j" +@class CPMenuItem @global CPApp /* diff --git a/AppKit/CPPasteboard.j b/AppKit/CPPasteboard.j index e93d1ddfa..8f5c4f754 100644 --- a/AppKit/CPPasteboard.j +++ b/AppKit/CPPasteboard.j @@ -26,6 +26,7 @@ @import @import +@typedef CPWebScriptObject CPGeneralPboard = @"CPGeneralPboard"; CPFontPboard = @"CPFontPboard"; @@ -66,7 +67,7 @@ var CPPasteboards = nil, unsigned _changeCount; CPString _stateUID; - WebScriptObject _nativePasteboard; + CPWebScriptObject _nativePasteboard; } /* diff --git a/AppKit/CPProgressIndicator.j b/AppKit/CPProgressIndicator.j index e0ea06ab4..3732c229b 100644 --- a/AppKit/CPProgressIndicator.j +++ b/AppKit/CPProgressIndicator.j @@ -26,6 +26,7 @@ @import "CPWindow_Constants.j" +@typedef CPProgressIndicatorStyle /* @global @group CPProgressIndicatorStyle diff --git a/AppKit/CPRadio.j b/AppKit/CPRadio.j index 8cf37cc3d..bb845aef3 100644 --- a/AppKit/CPRadio.j +++ b/AppKit/CPRadio.j @@ -25,6 +25,8 @@ @import "CPButton.j" +@class CPRadioGroup + @global CPApp diff --git a/AppKit/CPResponder.j b/AppKit/CPResponder.j index 08e3db3ac..eddf8b628 100644 --- a/AppKit/CPResponder.j +++ b/AppKit/CPResponder.j @@ -26,6 +26,7 @@ @import "CPEvent.j" @class CPKeyBinding +@class CPMenu CPDeleteKeyCode = 8; CPTabKeyCode = 9; diff --git a/AppKit/CPRuleEditor/CPRuleEditor_Constants.j b/AppKit/CPRuleEditor/CPRuleEditor_Constants.j index d68b6f48a..0870aedeb 100644 --- a/AppKit/CPRuleEditor/CPRuleEditor_Constants.j +++ b/AppKit/CPRuleEditor/CPRuleEditor_Constants.j @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + CPRuleEditorPredicateLeftExpression = "CPRuleEditorPredicateLeftExpression"; CPRuleEditorPredicateRightExpression = "CPRuleEditorPredicateRightExpression"; CPRuleEditorPredicateComparisonModifier = "CPRuleEditorPredicateComparisonModifier"; @@ -36,5 +37,6 @@ CPRuleEditorNestingModeList = 1; // Allows a single list, with no nes CPRuleEditorNestingModeCompound = 2; // Unlimited nesting and compound rows; this is the default CPRuleEditorNestingModeSimple = 3; // One compound row at the top with subrows beneath it, and no further nesting allowed +@typedef CPRuleEditorRowType CPRuleEditorRowTypeSimple = 0; CPRuleEditorRowTypeCompound = 1; diff --git a/AppKit/CPRuleEditor/_CPPredicateEditorTree.j b/AppKit/CPRuleEditor/_CPPredicateEditorTree.j index f0d47086f..8cb807a84 100644 --- a/AppKit/CPRuleEditor/_CPPredicateEditorTree.j +++ b/AppKit/CPRuleEditor/_CPPredicateEditorTree.j @@ -20,6 +20,8 @@ @import @import +@class CPPredicateEditorRowTemplate + @implementation _CPPredicateEditorTree : CPObject { CPPredicateEditorRowTemplate template @accessors; diff --git a/AppKit/CPRuleEditor/_CPRuleEditorViewSlice.j b/AppKit/CPRuleEditor/_CPRuleEditorViewSlice.j index 39a6a1d47..2cec0efae 100644 --- a/AppKit/CPRuleEditor/_CPRuleEditorViewSlice.j +++ b/AppKit/CPRuleEditor/_CPRuleEditorViewSlice.j @@ -19,6 +19,8 @@ @import "CPView.j" +@class CPRuleEditor + @implementation _CPRuleEditorViewSlice : CPView { CPRuleEditor _ruleEditor; diff --git a/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j b/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j index 30470d5c6..d11eceb64 100644 --- a/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j +++ b/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j @@ -24,6 +24,8 @@ @import "CPDatePicker.j" @import "CPPopUpButton.j" +@class CPRuleEditorRowType + @global CPApp @global CPMiniControlSize @global CPSmallControlSize diff --git a/AppKit/CPScroller.j b/AppKit/CPScroller.j index efb3f5b2e..f293b34dd 100644 --- a/AppKit/CPScroller.j +++ b/AppKit/CPScroller.j @@ -33,6 +33,7 @@ @global CPApp // CPScroller Constants +@typedef CPScrollerPart CPScrollerNoPart = 0; CPScrollerDecrementPage = 1; CPScrollerKnob = 2; @@ -44,6 +45,7 @@ CPScrollerKnobSlot = 6; CPScrollerIncrementArrow = 0; CPScrollerDecrementArrow = 1; +@typedef CPUsableScrollerParts CPNoScrollerParts = 0; CPOnlyScrollerArrows = 1; CPAllScrollerParts = 2; diff --git a/AppKit/CPSegmentedControl.j b/AppKit/CPSegmentedControl.j index e95993152..e58d97ef1 100644 --- a/AppKit/CPSegmentedControl.j +++ b/AppKit/CPSegmentedControl.j @@ -28,6 +28,7 @@ @global CPApp +@typedef CPSegmentSwitchTracking CPSegmentSwitchTrackingSelectOne = 0; CPSegmentSwitchTrackingSelectAny = 1; CPSegmentSwitchTrackingMomentary = 2; diff --git a/AppKit/CPShadowView.j b/AppKit/CPShadowView.j index 5fcc5c26c..c6c223705 100644 --- a/AppKit/CPShadowView.j +++ b/AppKit/CPShadowView.j @@ -26,7 +26,7 @@ @import "CPImage.j" @import "CPView.j" - +@typedef CPShadowWeight CPLightShadow = 0; CPHeavyShadow = 1; diff --git a/AppKit/CPTabView.j b/AppKit/CPTabView.j index 75f1d1ad5..ec145d802 100644 --- a/AppKit/CPTabView.j +++ b/AppKit/CPTabView.j @@ -25,6 +25,7 @@ @import "CPTabViewItem.j" @import "CPView.j" +@typedef CPTabViewType CPTopTabsBezelBorder = 0; //CPLeftTabsBezelBorder = 1; CPBottomTabsBezelBorder = 2; diff --git a/AppKit/CPTabViewItem.j b/AppKit/CPTabViewItem.j index 6c073b1d0..671d5bc78 100644 --- a/AppKit/CPTabViewItem.j +++ b/AppKit/CPTabViewItem.j @@ -23,7 +23,7 @@ @import @import "CPView.j" - +@class CPTabView /* The tab is currently selected. diff --git a/AppKit/CPTableColumn.j b/AppKit/CPTableColumn.j index 951cf45e4..e0f944a8e 100644 --- a/AppKit/CPTableColumn.j +++ b/AppKit/CPTableColumn.j @@ -31,6 +31,7 @@ @global CPTableViewColumnDidResizeNotification @class _CPTableColumnHeaderView +@class CPTableView CPTableColumnNoResizing = 0; CPTableColumnAutoresizingMask = 1 << 0; diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 48157b537..e0961f6fa 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -42,6 +42,7 @@ @class CPTableHeaderView @class CPClipView @class CPButton +@class _CPDropOperationDrawingView @global CPApp @@ -170,7 +171,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; @implementation _CPTableDrawView : CPView { - CPTableView _tableView; + id _tableView; } - (id)initWithTableView:(CPTableView)aTableView diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index 5f11f1d6e..28420db70 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -41,6 +41,7 @@ var CPTextFieldDelegate_control_didFailToFormatString_errorDescription_ = 1 << 1; +@typedef CPTextFieldBezelStyle CPTextFieldSquareBezel = 0; /*! A textfield bezel with squared corners. */ CPTextFieldRoundedBezel = 1; /*! A textfield bezel with rounded corners. */ diff --git a/AppKit/CPTheme.j b/AppKit/CPTheme.j index f87c3a2a2..426c462ca 100644 --- a/AppKit/CPTheme.j +++ b/AppKit/CPTheme.j @@ -26,6 +26,7 @@ @import @class CPView +@class _CPThemeAttribute var CPThemesByName = { }, CPThemeDefaultTheme = nil, diff --git a/AppKit/CPTokenField.j b/AppKit/CPTokenField.j index cc4b96765..705435aae 100644 --- a/AppKit/CPTokenField.j +++ b/AppKit/CPTokenField.j @@ -33,6 +33,9 @@ @import "CPTextField.j" @import "CPWindow_Constants.j" +@class _CPTokenFieldTokenCloseButton +@class _CPTokenFieldTokenDisclosureButton + @global CPApp @global CPTextFieldDidFocusNotification @global CPTextFieldDidBlurNotification diff --git a/AppKit/CPToolbar.j b/AppKit/CPToolbar.j index 3cc711518..49c78924e 100644 --- a/AppKit/CPToolbar.j +++ b/AppKit/CPToolbar.j @@ -37,6 +37,8 @@ var CPToolbarDelegate_toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar_ CPToolbarDelegate_toolbarSelectableItemIdentifiers_ = 1 << 4, CPToolbarDelegate_toolbarWillAddItem_ = 1 << 5; + +@typedef CPToolbarDisplayMode /* @global @group CPToolbarDisplayMode @@ -58,7 +60,7 @@ CPToolbarDisplayModeIconOnly = 2; */ CPToolbarDisplayModeLabelOnly = 3; - +@typedef CPToolbarSizeMode CPToolbarSizeModeDefault = 0; CPToolbarSizeModeRegular = 1; CPToolbarSizeModeSmall = 2; diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 1a600667c..70068d668 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -40,9 +40,12 @@ @class CPMenu @class CPClipView @class CPScrollView +@class CALayer @global appkit_tag_dom_elements +@typedef _CPViewFullScreenModeState + #if PLATFORM(DOM) if (typeof(appkit_tag_dom_elements) !== "undefined" && appkit_tag_dom_elements) diff --git a/AppKit/CPWebView.j b/AppKit/CPWebView.j index 98cc59caa..3f2ca713e 100644 --- a/AppKit/CPWebView.j +++ b/AppKit/CPWebView.j @@ -93,7 +93,7 @@ CPWebViewAppKitScrollMaxPollCount = 3; CPScrollView _scrollView; CPView _frameView; - IFrame _iframe; + DOMElement _iframe; CPString _mainFrameURL; CPArray _backwardStack; CPArray _forwardStack; diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index f770fc642..21a1b3f2d 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -50,9 +50,15 @@ @class CPMenu @class CPProgressIndicator +@class CPToolbar +@class CPWindowController +@class _CPWindowFrameAnimation @global CPApp +@typedef _CPWindowFullPlatformWindowSession + + @protocol CPWindowDelegate @optional diff --git a/AppKit/CPWindow/CPWindow_Constants.j b/AppKit/CPWindow/CPWindow_Constants.j index a9a2c3327..0caf4de78 100644 --- a/AppKit/CPWindow/CPWindow_Constants.j +++ b/AppKit/CPWindow/CPWindow_Constants.j @@ -81,6 +81,7 @@ CPWindowMinYMargin = 8; CPWindowHeightSizable = 16; CPWindowMaxYMargin = 32; +@typedef CPWindowLevel CPBackgroundWindowLevel = -1; /* Default level for windows @@ -143,6 +144,7 @@ CPDraggingWindowLevel = 500; */ CPScreenSaverWindowLevel = 1000; +@typedef CPWindowOrderingMode /* The receiver is placed directly in front of the window specified. @global diff --git a/AppKit/CoreGraphics/CGAffineTransform.j b/AppKit/CoreGraphics/CGAffineTransform.j index b73f26f07..0cfb36bcf 100644 --- a/AppKit/CoreGraphics/CGAffineTransform.j +++ b/AppKit/CoreGraphics/CGAffineTransform.j @@ -22,6 +22,8 @@ @import "CGGeometry.j" +@typedef CGAffineTransform + function CGAffineTransformMake(a, b, c, d, tx, ty) { diff --git a/AppKit/CoreGraphics/CGColorSpace.j b/AppKit/CoreGraphics/CGColorSpace.j index 9502a0703..e5d7673e8 100644 --- a/AppKit/CoreGraphics/CGColorSpace.j +++ b/AppKit/CoreGraphics/CGColorSpace.j @@ -20,6 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@typedef CGColorSpace + kCGColorSpaceModelUnknown = -1; kCGColorSpaceModelMonochrome = 0; kCGColorSpaceModelRGB = 1; diff --git a/AppKit/CoreGraphics/CGContext.j b/AppKit/CoreGraphics/CGContext.j index c0b43eabd..a00199586 100644 --- a/AppKit/CoreGraphics/CGContext.j +++ b/AppKit/CoreGraphics/CGContext.j @@ -25,6 +25,7 @@ @import "CGGeometry.j" @import "CGPath.j" +@typedef CGContext kCGLineCapButt = 0; kCGLineCapRound = 1; diff --git a/AppKit/CoreGraphics/CGGradient.j b/AppKit/CoreGraphics/CGGradient.j index 3681c086e..aea212219 100644 --- a/AppKit/CoreGraphics/CGGradient.j +++ b/AppKit/CoreGraphics/CGGradient.j @@ -23,6 +23,7 @@ @import "CGColor.j" @import "CGColorSpace.j" +@typedef CGGradient kCGGradientDrawsBeforeStartLocation = 1 << 0; kCGGradientDrawsAfterEndLocation = 1 << 1; diff --git a/AppKit/CoreGraphics/CGPath.j b/AppKit/CoreGraphics/CGPath.j index 45c5d9062..b7cea5164 100644 --- a/AppKit/CoreGraphics/CGPath.j +++ b/AppKit/CoreGraphics/CGPath.j @@ -23,6 +23,7 @@ @import "CGAffineTransform.j" @import "CGGeometry.j" +@typedef CGPath kCGPathElementMoveToPoint = 0; kCGPathElementAddLineToPoint = 1; @@ -629,4 +630,4 @@ function CGPathContainsPoint(aPath, aTransform, point, eoFill) /*! @} -*/ \ No newline at end of file +*/ diff --git a/AppKit/Platform/CPPlatformWindow.j b/AppKit/Platform/CPPlatformWindow.j index 628293117..3e2ff2817 100644 --- a/AppKit/Platform/CPPlatformWindow.j +++ b/AppKit/Platform/CPPlatformWindow.j @@ -27,9 +27,12 @@ @class CPMenu @class CPPlatformPasteboard +@class CPWindow @global CPApp +@typedef DOMWindow + var PrimaryPlatformWindow = NULL; @implementation CPPlatformWindow : CPObject diff --git a/AppKit/_CPImageAndTextView.j b/AppKit/_CPImageAndTextView.j index 63b9d60b6..1a02755f5 100644 --- a/AppKit/_CPImageAndTextView.j +++ b/AppKit/_CPImageAndTextView.j @@ -71,7 +71,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0, #if PLATFORM(DOM) DOMElement _DOMImageElement; - DOMELement _DOMTextElement; + DOMElement _DOMTextElement; DOMElement _DOMTextShadowElement; #endif } diff --git a/AppKit/_CPPopUpList.j b/AppKit/_CPPopUpList.j index 2604f3652..3dd357132 100644 --- a/AppKit/_CPPopUpList.j +++ b/AppKit/_CPPopUpList.j @@ -65,6 +65,113 @@ var ListMinimumItems = 3; var ListColumnIdentifier = @"1"; +@implementation _CPPopUpPanel : CPPanel + +- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned)aStyleMask +{ + if (self = [super initWithContentRect:aContentRect styleMask:aStyleMask]) + _constrainsToUsableScreen = NO; + + [self _trapNextMouseDown]; + + return self; +} + +/*! + Returns \c YES if the receiver is able to receive input events + even when a modal session is active. +*/ +- (BOOL)worksWhenModal +{ + return YES; +} + +- (void)sendEvent:(CPEvent)anEvent +{ + var type = [anEvent type]; + + if (type === CPLeftMouseDown || type === CPRightMouseDown) + [[self delegate] setListWasClicked:YES]; + + return [super sendEvent:anEvent]; +} + +- (void)orderFront:(id)sender +{ + [self _trapNextMouseDown]; + [super orderFront:sender]; +} + +- (void)_mouseWasClicked:(CPEvent)anEvent +{ + var mouseWindow = [anEvent window], + rect = [[[self delegate] dataSource] bounds], + point = [[[self delegate] dataSource] convertPoint:[anEvent locationInWindow] fromView:nil]; + + if (mouseWindow != self && !CGRectContainsPoint(rect, point)) + [[self delegate] close]; + else + [self _trapNextMouseDown]; +} + +- (void)_trapNextMouseDown +{ + // Don't dequeue the event so clicks in controls will work + [CPApp setTarget:self selector:@selector(_mouseWasClicked:) forNextEventMatchingMask:CPLeftMouseDownMask untilDate:nil inMode:CPDefaultRunLoopMode dequeue:NO]; +} + +@end + +@implementation _CPPopUpTableView : CPTableView +{ + BOOL _acceptFirstResponder; +} + +- (id)initWithFrame:(CGRect)aFrame +{ + if (self = [super initWithFrame:aFrame]) + { + // We want the autocomplete to remain first responder until we are clicked. + _acceptFirstResponder = NO; + } + + return self; +} + +- (void)trackMouse:(CPEvent)anEvent +{ + if (![self isEnabled]) + return; + + [[self delegate] setItemWasClicked:YES]; + + // CPTableView will not track the click if it is not first responder + _acceptFirstResponder = YES; + [[self window] makeFirstResponder:self]; + [super trackMouse:anEvent]; +} + +- (void)stopTracking:(CGPoint)lastPoint at:(CGPoint)aPoint mouseIsUp:(BOOL)mouseIsUp +{ + _acceptFirstResponder = NO; + [super stopTracking:lastPoint at:aPoint mouseIsUp:mouseIsUp]; +} + +- (BOOL)acceptsFirstResponder +{ + return _acceptFirstResponder; +} + +/*! + Return the column used for the list. +*/ +- (CPTableColumn)listColumn +{ + return _tableColumns[0]; +} + +@end + /*! This class is a controller for a panel that can pop up and display a scrollable list of items in a CPTableView. It is used by CPComboBox to display the list of choices. @@ -800,110 +907,3 @@ var _CPPopUpListDataSourceKey = @"_CPPopUpListDataSourceKey", } @end - -@implementation _CPPopUpTableView : CPTableView -{ - BOOL _acceptFirstResponder; -} - -- (id)initWithFrame:(CGRect)aFrame -{ - if (self = [super initWithFrame:aFrame]) - { - // We want the autocomplete to remain first responder until we are clicked. - _acceptFirstResponder = NO; - } - - return self; -} - -- (void)trackMouse:(CPEvent)anEvent -{ - if (![self isEnabled]) - return; - - [[self delegate] setItemWasClicked:YES]; - - // CPTableView will not track the click if it is not first responder - _acceptFirstResponder = YES; - [[self window] makeFirstResponder:self]; - [super trackMouse:anEvent]; -} - -- (void)stopTracking:(CGPoint)lastPoint at:(CGPoint)aPoint mouseIsUp:(BOOL)mouseIsUp -{ - _acceptFirstResponder = NO; - [super stopTracking:lastPoint at:aPoint mouseIsUp:mouseIsUp]; -} - -- (BOOL)acceptsFirstResponder -{ - return _acceptFirstResponder; -} - -/*! - Return the column used for the list. -*/ -- (CPTableColumn)listColumn -{ - return _tableColumns[0]; -} - -@end - -@implementation _CPPopUpPanel : CPPanel - -- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned)aStyleMask -{ - if (self = [super initWithContentRect:aContentRect styleMask:aStyleMask]) - _constrainsToUsableScreen = NO; - - [self _trapNextMouseDown]; - - return self; -} - -/*! - Returns \c YES if the receiver is able to receive input events - even when a modal session is active. -*/ -- (BOOL)worksWhenModal -{ - return YES; -} - -- (void)sendEvent:(CPEvent)anEvent -{ - var type = [anEvent type]; - - if (type === CPLeftMouseDown || type === CPRightMouseDown) - [[self delegate] setListWasClicked:YES]; - - return [super sendEvent:anEvent]; -} - -- (void)orderFront:(id)sender -{ - [self _trapNextMouseDown]; - [super orderFront:sender]; -} - -- (void)_mouseWasClicked:(CPEvent)anEvent -{ - var mouseWindow = [anEvent window], - rect = [[[self delegate] dataSource] bounds], - point = [[[self delegate] dataSource] convertPoint:[anEvent locationInWindow] fromView:nil]; - - if (mouseWindow != self && !CGRectContainsPoint(rect, point)) - [[self delegate] close]; - else - [self _trapNextMouseDown]; -} - -- (void)_trapNextMouseDown -{ - // Don't dequeue the event so clicks in controls will work - [CPApp setTarget:self selector:@selector(_mouseWasClicked:) forNextEventMatchingMask:CPLeftMouseDownMask untilDate:nil inMode:CPDefaultRunLoopMode dequeue:NO]; -} - -@end diff --git a/AppKit/_CPToolbarItem.j b/AppKit/_CPToolbarItem.j index 5d5600b47..387805535 100644 --- a/AppKit/_CPToolbarItem.j +++ b/AppKit/_CPToolbarItem.j @@ -26,6 +26,7 @@ @import "CPImage.j" @import "CPView.j" +@class CPToolbar @global CPApp CPToolbarItemVisibilityPriorityStandard = 0; diff --git a/Foundation/CPDateFormatter.j b/Foundation/CPDateFormatter.j index 9f1badc65..b7c74cbf1 100644 --- a/Foundation/CPDateFormatter.j +++ b/Foundation/CPDateFormatter.j @@ -32,12 +32,14 @@ @global CPLocaleLanguageCode @global CPLocaleCountryCode +@typedef CPDateFormatterStyle CPDateFormatterNoStyle = 0; CPDateFormatterShortStyle = 1; CPDateFormatterMediumStyle = 2; CPDateFormatterLongStyle = 3; CPDateFormatterFullStyle = 4; +@typedef CPDateFormatterBehavior CPDateFormatterBehaviorDefault = 0; CPDateFormatterBehavior10_0 = 1000; CPDateFormatterBehavior10_4 = 1040; diff --git a/Foundation/CPDecimal.j b/Foundation/CPDecimal.j index 15d2f817d..72fbe89cc 100644 --- a/Foundation/CPDecimal.j +++ b/Foundation/CPDecimal.j @@ -52,6 +52,8 @@ @import "CPArray.j" @import "CPNumber.j" +@typedef CPDecimal + // Decimal size limits CPDecimalMaxDigits = 38; CPDecimalMaxExponent = 127; @@ -68,6 +70,7 @@ CPCalculationUnderflow = 3; CPCalculationDivideByZero = 4; //CPRoundingMode Enum +@typedef CPRoundingMode CPRoundPlain = 1; CPRoundDown = 2; CPRoundUp = 3; diff --git a/Foundation/CPDictionary.j b/Foundation/CPDictionary.j index b95792f78..9c673be0c 100755 --- a/Foundation/CPDictionary.j +++ b/Foundation/CPDictionary.j @@ -31,38 +31,6 @@ var CPDictionaryShowNilDeprecationMessage = YES, CPDictionaryMaxDescriptionRecursion = 10; -/* @ignore */ -@implementation _CPDictionaryValueEnumerator : CPEnumerator -{ - CPEnumerator _keyEnumerator; - CPDictionary _dictionary; -} - -- (id)initWithDictionary:(CPDictionary)aDictionary -{ - self = [super init]; - - if (self) - { - _keyEnumerator = [aDictionary keyEnumerator]; - _dictionary = aDictionary; - } - - return self; -} - -- (id)nextObject -{ - var key = [_keyEnumerator nextObject]; - - if (key === nil) - return nil; - - return [_dictionary objectForKey:key]; -} - -@end - /*! @class CPDictionary @ingroup foundation @@ -801,6 +769,40 @@ var CPDictionaryShowNilDeprecationMessage = YES, @end + +/* @ignore */ +@implementation _CPDictionaryValueEnumerator : CPEnumerator +{ + CPEnumerator _keyEnumerator; + CPDictionary _dictionary; +} + +- (id)initWithDictionary:(CPDictionary)aDictionary +{ + self = [super init]; + + if (self) + { + _keyEnumerator = [aDictionary keyEnumerator]; + _dictionary = aDictionary; + } + + return self; +} + +- (id)nextObject +{ + var key = [_keyEnumerator nextObject]; + + if (key === nil) + return nil; + + return [_dictionary objectForKey:key]; +} + +@end + + /*! @class CPMutableDictionary @ingroup compatibility diff --git a/Foundation/CPGeometry.j b/Foundation/CPGeometry.j index 93a3a2b05..f8ef04a4c 100644 --- a/Foundation/CPGeometry.j +++ b/Foundation/CPGeometry.j @@ -22,6 +22,7 @@ @import "_CGGeometry.j" +@typedef CPRectEdge CPMinXEdge = 0; CPMinYEdge = 1; CPMaxXEdge = 2; diff --git a/Foundation/CPJSONPConnection.j b/Foundation/CPJSONPConnection.j index 0330cb223..374395784 100644 --- a/Foundation/CPJSONPConnection.j +++ b/Foundation/CPJSONPConnection.j @@ -23,6 +23,7 @@ @import "CPException.j" @import "CPObject.j" @import "CPRunLoop.j" +@import "CPURLRequest.j" CPJSONPConnectionCallbacks = {}; diff --git a/Foundation/CPNotificationCenter.j b/Foundation/CPNotificationCenter.j index 99ab18183..d8744fe11 100644 --- a/Foundation/CPNotificationCenter.j +++ b/Foundation/CPNotificationCenter.j @@ -29,151 +29,6 @@ var CPNotificationDefaultCenter = nil; -/*! - @class CPNotificationCenter - @ingroup foundation - @brief Sends messages (CPNotification) between objects. - - Cappuccino provides a framework for sending messages between objects within - a process called notifications. Objects register with an - CPNotificationCenter to be informed whenever other objects post - CPNotifications to it matching certain criteria. The notification center - processes notifications synchronously -- that is, control is only returned - to the notification poster once every recipient of the notification has - received it and processed it. -*/ -@implementation CPNotificationCenter : CPObject -{ - CPMutableDictionary _namedRegistries; - _CPNotificationRegistry _unnamedRegistry; -} - -/*! - Returns the application's notification center -*/ -+ (CPNotificationCenter)defaultCenter -{ - if (!CPNotificationDefaultCenter) - CPNotificationDefaultCenter = [[CPNotificationCenter alloc] init]; - - return CPNotificationDefaultCenter; -} - -- (id)init -{ - self = [super init]; - - if (self) - { - _namedRegistries = @{}; - _unnamedRegistry = [[_CPNotificationRegistry alloc] init]; - } - return self; -} - -/*! - Adds an object as an observer. The observer will receive notifications with the specified name - and/or containing the specified object (depending on if they are \c nil. - @param anObserver the observing object - @param aSelector the message sent to the observer when a notification occurs - @param aNotificationName the name of the notification the observer wants to watch - @param anObject the object in the notification the observer wants to watch -*/ -- (void)addObserver:(id)anObserver selector:(SEL)aSelector name:(CPString)aNotificationName object:(id)anObject -{ - var registry, - observer = [[_CPNotificationObserver alloc] initWithObserver:anObserver selector:aSelector]; - - if (aNotificationName == nil) - registry = _unnamedRegistry; - else if (!(registry = [_namedRegistries objectForKey:aNotificationName])) - { - registry = [[_CPNotificationRegistry alloc] init]; - [_namedRegistries setObject:registry forKey:aNotificationName]; - } - - [registry addObserver:observer object:anObject]; -} - -/*! - Unregisters the specified observer from all notifications. - @param anObserver the observer to unregister -*/ -- (void)removeObserver:(id)anObserver -{ - var name = nil, - names = [_namedRegistries keyEnumerator]; - - while ((name = [names nextObject]) !== nil) - [[_namedRegistries objectForKey:name] removeObserver:anObserver object:nil]; - - [_unnamedRegistry removeObserver:anObserver object:nil]; -} - -/*! - Unregisters the specified observer from notifications matching the specified name and/or object. - @param anObserver the observer to remove - @param aNotificationName the name of notifications to no longer watch - @param anObject notifications containing this object will no longer be watched -*/ -- (void)removeObserver:(id)anObserver name:(CPString)aNotificationName object:(id)anObject -{ - if (aNotificationName == nil) - { - var name = nil, - names = [_namedRegistries keyEnumerator]; - - while ((name = [names nextObject]) !== nil) - [[_namedRegistries objectForKey:name] removeObserver:anObserver object:anObject]; - - [_unnamedRegistry removeObserver:anObserver object:anObject]; - } - else - [[_namedRegistries objectForKey:aNotificationName] removeObserver:anObserver object:anObject]; -} - -/*! - Posts a notification to all observers that match the specified notification's name and object. - @param aNotification the notification being posted - @throws CPInvalidArgumentException if aNotification is nil -*/ -- (void)postNotification:(CPNotification)aNotification -{ - if (!aNotification) - [CPException raise:CPInvalidArgumentException reason:"postNotification: does not except 'nil' notifications"]; - - _CPNotificationCenterPostNotification(self, aNotification); -} - -/*! - Posts a new notification with the specified name, object, and dictionary. - @param aNotificationName the name of the notification name - @param anObject the associated object - @param aUserInfo the associated dictionary -*/ -- (void)postNotificationName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo -{ - _CPNotificationCenterPostNotification(self, [[CPNotification alloc] initWithName:aNotificationName object:anObject userInfo:aUserInfo]); -} - -/*! - Posts a new notification with the specified name and object. - @param aNotificationName the name of the notification - @param anObject the associated object -*/ -- (void)postNotificationName:(CPString)aNotificationName object:(id)anObject -{ - _CPNotificationCenterPostNotification(self, [[CPNotification alloc] initWithName:aNotificationName object:anObject userInfo:nil]); -} - -@end - -var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */ self, /* CPNotification */ aNotification) -{ - [self._unnamedRegistry postNotification:aNotification]; - [[self._namedRegistries objectForKey:[aNotification name]] postNotification:aNotification]; -}; - /* Mapping of Notification Name to listening object/selector. @ignore @@ -338,3 +193,149 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */ } @end + + +/*! + @class CPNotificationCenter + @ingroup foundation + @brief Sends messages (CPNotification) between objects. + + Cappuccino provides a framework for sending messages between objects within + a process called notifications. Objects register with an + CPNotificationCenter to be informed whenever other objects post + CPNotifications to it matching certain criteria. The notification center + processes notifications synchronously -- that is, control is only returned + to the notification poster once every recipient of the notification has + received it and processed it. +*/ +@implementation CPNotificationCenter : CPObject +{ + CPMutableDictionary _namedRegistries; + _CPNotificationRegistry _unnamedRegistry; +} + +/*! + Returns the application's notification center +*/ ++ (CPNotificationCenter)defaultCenter +{ + if (!CPNotificationDefaultCenter) + CPNotificationDefaultCenter = [[CPNotificationCenter alloc] init]; + + return CPNotificationDefaultCenter; +} + +- (id)init +{ + self = [super init]; + + if (self) + { + _namedRegistries = @{}; + _unnamedRegistry = [[_CPNotificationRegistry alloc] init]; + } + return self; +} + +/*! + Adds an object as an observer. The observer will receive notifications with the specified name + and/or containing the specified object (depending on if they are \c nil. + @param anObserver the observing object + @param aSelector the message sent to the observer when a notification occurs + @param aNotificationName the name of the notification the observer wants to watch + @param anObject the object in the notification the observer wants to watch +*/ +- (void)addObserver:(id)anObserver selector:(SEL)aSelector name:(CPString)aNotificationName object:(id)anObject +{ + var registry, + observer = [[_CPNotificationObserver alloc] initWithObserver:anObserver selector:aSelector]; + + if (aNotificationName == nil) + registry = _unnamedRegistry; + else if (!(registry = [_namedRegistries objectForKey:aNotificationName])) + { + registry = [[_CPNotificationRegistry alloc] init]; + [_namedRegistries setObject:registry forKey:aNotificationName]; + } + + [registry addObserver:observer object:anObject]; +} + +/*! + Unregisters the specified observer from all notifications. + @param anObserver the observer to unregister +*/ +- (void)removeObserver:(id)anObserver +{ + var name = nil, + names = [_namedRegistries keyEnumerator]; + + while ((name = [names nextObject]) !== nil) + [[_namedRegistries objectForKey:name] removeObserver:anObserver object:nil]; + + [_unnamedRegistry removeObserver:anObserver object:nil]; +} + +/*! + Unregisters the specified observer from notifications matching the specified name and/or object. + @param anObserver the observer to remove + @param aNotificationName the name of notifications to no longer watch + @param anObject notifications containing this object will no longer be watched +*/ +- (void)removeObserver:(id)anObserver name:(CPString)aNotificationName object:(id)anObject +{ + if (aNotificationName == nil) + { + var name = nil, + names = [_namedRegistries keyEnumerator]; + + while ((name = [names nextObject]) !== nil) + [[_namedRegistries objectForKey:name] removeObserver:anObserver object:anObject]; + + [_unnamedRegistry removeObserver:anObserver object:anObject]; + } + else + [[_namedRegistries objectForKey:aNotificationName] removeObserver:anObserver object:anObject]; +} + +/*! + Posts a notification to all observers that match the specified notification's name and object. + @param aNotification the notification being posted + @throws CPInvalidArgumentException if aNotification is nil +*/ +- (void)postNotification:(CPNotification)aNotification +{ + if (!aNotification) + [CPException raise:CPInvalidArgumentException reason:"postNotification: does not except 'nil' notifications"]; + + _CPNotificationCenterPostNotification(self, aNotification); +} + +/*! + Posts a new notification with the specified name, object, and dictionary. + @param aNotificationName the name of the notification name + @param anObject the associated object + @param aUserInfo the associated dictionary +*/ +- (void)postNotificationName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo +{ + _CPNotificationCenterPostNotification(self, [[CPNotification alloc] initWithName:aNotificationName object:anObject userInfo:aUserInfo]); +} + +/*! + Posts a new notification with the specified name and object. + @param aNotificationName the name of the notification + @param anObject the associated object +*/ +- (void)postNotificationName:(CPString)aNotificationName object:(id)anObject +{ + _CPNotificationCenterPostNotification(self, [[CPNotification alloc] initWithName:aNotificationName object:anObject userInfo:nil]); +} + +@end + +var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */ self, /* CPNotification */ aNotification) +{ + [self._unnamedRegistry postNotification:aNotification]; + [[self._namedRegistries objectForKey:[aNotification name]] postNotification:aNotification]; +}; diff --git a/Foundation/CPNumberFormatter.j b/Foundation/CPNumberFormatter.j index f59dca490..52737fc1c 100644 --- a/Foundation/CPNumberFormatter.j +++ b/Foundation/CPNumberFormatter.j @@ -24,7 +24,7 @@ @import "CPFormatter.j" @import "CPDecimalNumber.j" - +@typedef CPNumberFormatterStyle CPNumberFormatterNoStyle = 0; CPNumberFormatterDecimalStyle = 1; CPNumberFormatterCurrencyStyle = 2; @@ -32,6 +32,7 @@ CPNumberFormatterPercentStyle = 3; CPNumberFormatterScientificStyle = 4; CPNumberFormatterSpellOutStyle = 5; +@typedef CPNumberFormatterRoundingMode CPNumberFormatterRoundCeiling = CPRoundUp; CPNumberFormatterRoundFloor = CPRoundDown; CPNumberFormatterRoundDown = CPRoundDown; diff --git a/Foundation/CPObject.j b/Foundation/CPObject.j index 912aafa09..f5aea7aa6 100644 --- a/Foundation/CPObject.j +++ b/Foundation/CPObject.j @@ -62,6 +62,8 @@ CPLog(@"Got some class: %@", inst); @todo document KVC usage. */ +@import "_CPTypeDefinitions.j" + @class CPString @class CPException @@ -104,7 +106,7 @@ CPLog(@"Got some class: %@", inst); @implementation CPObject { - Class isa; + id isa; } + (void)load diff --git a/Foundation/CPPredicate/CPComparisonPredicate.j b/Foundation/CPPredicate/CPComparisonPredicate.j index f2cfb3172..338a4e7f3 100644 --- a/Foundation/CPPredicate/CPComparisonPredicate.j +++ b/Foundation/CPPredicate/CPComparisonPredicate.j @@ -32,8 +32,8 @@ @import "_CPPredicate.j" -var CPComparisonPredicateModifier, - CPPredicateOperatorType; +@typedef CPComparisonPredicateModifier +@typedef CPPredicateOperatorType /*! @ingroup foundation diff --git a/Foundation/CPPredicate/CPCompoundPredicate.j b/Foundation/CPPredicate/CPCompoundPredicate.j index e36ceb0d0..a38f3b065 100644 --- a/Foundation/CPPredicate/CPCompoundPredicate.j +++ b/Foundation/CPPredicate/CPCompoundPredicate.j @@ -26,7 +26,7 @@ @import "CPArray.j" @import "_CPPredicate.j" -var CPCompoundPredicateType; +@typedef CPCompoundPredicateType /*! @class CPCompoundPredicate diff --git a/Foundation/CPRange.j b/Foundation/CPRange.j index c9f9c7c2a..58dd550bc 100755 --- a/Foundation/CPRange.j +++ b/Foundation/CPRange.j @@ -25,6 +25,8 @@ @{ */ +@typedef CPRange + /*! Makes a CPRange. @param location the location for new range diff --git a/Foundation/CPURLConnection.j b/Foundation/CPURLConnection.j index 420ce8402..88a1afbf8 100644 --- a/Foundation/CPURLConnection.j +++ b/Foundation/CPURLConnection.j @@ -26,6 +26,8 @@ @import "CPURLRequest.j" @import "CPURLResponse.j" +@typedef HTTPRequest + var CPURLConnectionDelegate = nil; /*! diff --git a/Foundation/CPUndoManager.j b/Foundation/CPUndoManager.j index af2111170..d4ad4914e 100644 --- a/Foundation/CPUndoManager.j +++ b/Foundation/CPUndoManager.j @@ -50,7 +50,7 @@ var _CPUndoGroupingPool = [], /* @ignore */ @implementation _CPUndoGrouping : CPObject { - _CPUndoGrouping _parent; + id _parent; CPMutableArray _invocations; CPString _actionName; } diff --git a/Foundation/CPUserSessionManager.j b/Foundation/CPUserSessionManager.j index b1cbd23cb..523a65e19 100644 --- a/Foundation/CPUserSessionManager.j +++ b/Foundation/CPUserSessionManager.j @@ -24,6 +24,7 @@ @import "CPObject.j" @import "CPString.j" +@typedef CPUserSessionStatus CPUserSessionUndeterminedStatus = 0; CPUserSessionLoggedInStatus = 1; CPUserSessionLoggedOutStatus = 2; diff --git a/Foundation/_CGGeometry.j b/Foundation/_CGGeometry.j index 4861ce8fd..d0482aa71 100644 --- a/Foundation/_CGGeometry.j +++ b/Foundation/_CGGeometry.j @@ -26,6 +26,12 @@ CGGeometry is not a part of Foundation. The reason _CGGeometry.j exists, and is */ +@typedef CGPoint +@typedef CGSize +@typedef CGRect +@typedef CGInset + + function CGPointMake(x, y) { return { x:x, y:y }; diff --git a/Foundation/_CPTypeDefinitions.j b/Foundation/_CPTypeDefinitions.j new file mode 100644 index 000000000..7aa874fe1 --- /dev/null +++ b/Foundation/_CPTypeDefinitions.j @@ -0,0 +1,30 @@ +/* + * _CPTypeDefintions.j + * Foundation + * + * Created by Antoine Mercadal. + * Copyright 2014, Antoine Mercadal. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +@typedef Class +@typedef CPInteger +@typedef CPUInteger +@typedef DOMElement +@typedef JSObject +@typedef CPMethodSignature +@typedef CPPropertyListFormat +@typedef CPTimeInterval