mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-28 19:08:50 +00:00
FIXED: New warnings reveleaded by ivar type checking
This patch fixes all new warnings
This commit is contained in:
1 parent
8ee443a43c
commit
f9275a70af
71 files changed
+496
-367
No files matched your search
+49
-48
@@ -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
|
||||
+1
-16
@@ -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;
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
@import "CPWindowController.j"
|
||||
@import "_CPPopoverWindow.j"
|
||||
|
||||
@typedef CPModalSession
|
||||
|
||||
var CPMainCibFile = @"CPMainCibFile",
|
||||
CPMainCibFileHumanFriendly = @"Main cib file base name",
|
||||
CPEventModifierFlags = 0;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
@import <Foundation/CPIndexSet.j>
|
||||
|
||||
@import <Foundation/CPPredicate.j>
|
||||
@import "CPObjectController.j"
|
||||
@import "CPKeyValueBinding.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;
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
@import "CPView.j"
|
||||
|
||||
@class CPSlider
|
||||
@class _CPColorPanelToolbar
|
||||
@class _CPColorPanelSwatches
|
||||
@class _CPColorPanelPreview
|
||||
|
||||
@global CPApp
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
@import "CPView.j"
|
||||
|
||||
@class CPSlider
|
||||
@class CPColorPanel
|
||||
@class __CPColorWheel
|
||||
|
||||
@global CPColorPickerViewWidth
|
||||
@global CPColorPickerViewHeight
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ var CPComboBoxTextSubview = @"text",
|
||||
{
|
||||
CPArray _items;
|
||||
_CPPopUpList _listDelegate;
|
||||
CPComboBoxDataSource _dataSource;
|
||||
id _dataSource;
|
||||
BOOL _usesDataSource;
|
||||
BOOL _completes;
|
||||
BOOL _canComplete;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
@import <Foundation/Foundation.j>
|
||||
|
||||
@class CPDatePicker
|
||||
@class _CPDatePickerMonthView
|
||||
@class _CPDatePickerHeaderView
|
||||
|
||||
@global CPApp
|
||||
@global CPSingleDateMode
|
||||
|
||||
@@ -31,6 +31,10 @@
|
||||
@import <Foundation/CPLocale.j>
|
||||
|
||||
@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
|
||||
@end
|
||||
@@ -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;
|
||||
|
||||
@@ -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]"),
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
@global CPImagesPboardType
|
||||
@global appkit_tag_dom_elements
|
||||
|
||||
@typedef CPImageAlignment
|
||||
CPImageAlignCenter = 0;
|
||||
CPImageAlignTop = 1;
|
||||
CPImageAlignTopLeft = 2;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
var exposedBindingsMap = @{},
|
||||
bindingsMap = @{};
|
||||
|
||||
@typedef CPBindingOperationKind
|
||||
var CPBindingOperationAnd = 0,
|
||||
CPBindingOperationOr = 1;
|
||||
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
|
||||
@global CPApp
|
||||
|
||||
@typedef CPTickMarkPosition
|
||||
CPTickMarkBelow = 0;
|
||||
CPTickMarkAbove = 1;
|
||||
CPTickMarkLeft = CPTickMarkAbove;
|
||||
CPTickMarkRight = CPTickMarkBelow;
|
||||
|
||||
@typedef CPLevelIndicatorStyle
|
||||
CPRelevancyLevelIndicatorStyle = 0;
|
||||
CPContinuousCapacityLevelIndicatorStyle = 1;
|
||||
CPDiscreteCapacityLevelIndicatorStyle = 2;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
@import "_CPMenuManager.j"
|
||||
|
||||
@class _CPMenuView
|
||||
@class CPMenu
|
||||
|
||||
@global CPMenuDidAddItemNotification
|
||||
@global CPMenuDidChangeItemNotification
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
@import "CPWindow.j"
|
||||
@import "_CPMenuManager.j"
|
||||
|
||||
@class _CPMenuView
|
||||
|
||||
var _CPMenuWindowPool = [],
|
||||
_CPMenuWindowPoolCapacity = 5,
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
@class _CPMenuBarWindow
|
||||
@class _CPMenuView
|
||||
@class CPMenuItem
|
||||
|
||||
@implementation _CPMenuItemMenuBarView : CPView
|
||||
{
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
@import "CPImageView.j"
|
||||
@import "_CPImageAndTextView.j"
|
||||
|
||||
@class CPMenuItem
|
||||
|
||||
|
||||
@implementation _CPMenuItemStandardView : CPView
|
||||
{
|
||||
CPMenuItem _menuItem @accessors(property=menuItem);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
@import "_CPMenuItemStandardView.j"
|
||||
@import "_CPMenuItemMenuBarView.j"
|
||||
|
||||
@class CPMenuItem
|
||||
@global CPApp
|
||||
|
||||
/*
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
@import <Foundation/CPDictionary.j>
|
||||
@import <Foundation/CPPropertyListSerialization.j>
|
||||
|
||||
@typedef CPWebScriptObject
|
||||
|
||||
CPGeneralPboard = @"CPGeneralPboard";
|
||||
CPFontPboard = @"CPFontPboard";
|
||||
@@ -66,7 +67,7 @@ var CPPasteboards = nil,
|
||||
unsigned _changeCount;
|
||||
CPString _stateUID;
|
||||
|
||||
WebScriptObject _nativePasteboard;
|
||||
CPWebScriptObject _nativePasteboard;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
@import "CPWindow_Constants.j"
|
||||
|
||||
|
||||
@typedef CPProgressIndicatorStyle
|
||||
/*
|
||||
@global
|
||||
@group CPProgressIndicatorStyle
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
@import "CPButton.j"
|
||||
|
||||
@class CPRadioGroup
|
||||
|
||||
@global CPApp
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
@import "CPEvent.j"
|
||||
|
||||
@class CPKeyBinding
|
||||
@class CPMenu
|
||||
|
||||
CPDeleteKeyCode = 8;
|
||||
CPTabKeyCode = 9;
|
||||
|
||||
@@ -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;
|
||||
@@ -20,6 +20,8 @@
|
||||
@import <Foundation/CPObject.j>
|
||||
@import <Foundation/CPString.j>
|
||||
|
||||
@class CPPredicateEditorRowTemplate
|
||||
|
||||
@implementation _CPPredicateEditorTree : CPObject
|
||||
{
|
||||
CPPredicateEditorRowTemplate template @accessors;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
@import "CPView.j"
|
||||
|
||||
@class CPRuleEditor
|
||||
|
||||
@implementation _CPRuleEditorViewSlice : CPView
|
||||
{
|
||||
CPRuleEditor _ruleEditor;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
@import "CPDatePicker.j"
|
||||
@import "CPPopUpButton.j"
|
||||
|
||||
@class CPRuleEditorRowType
|
||||
|
||||
@global CPApp
|
||||
@global CPMiniControlSize
|
||||
@global CPSmallControlSize
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
@global CPApp
|
||||
|
||||
@typedef CPSegmentSwitchTracking
|
||||
CPSegmentSwitchTrackingSelectOne = 0;
|
||||
CPSegmentSwitchTrackingSelectAny = 1;
|
||||
CPSegmentSwitchTrackingMomentary = 2;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
@import "CPImage.j"
|
||||
@import "CPView.j"
|
||||
|
||||
|
||||
@typedef CPShadowWeight
|
||||
CPLightShadow = 0;
|
||||
CPHeavyShadow = 1;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
@import "CPTabViewItem.j"
|
||||
@import "CPView.j"
|
||||
|
||||
@typedef CPTabViewType
|
||||
CPTopTabsBezelBorder = 0;
|
||||
//CPLeftTabsBezelBorder = 1;
|
||||
CPBottomTabsBezelBorder = 2;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
@import "CPView.j"
|
||||
|
||||
@class CPTabView
|
||||
|
||||
/*
|
||||
The tab is currently selected.
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
@global CPTableViewColumnDidResizeNotification
|
||||
|
||||
@class _CPTableColumnHeaderView
|
||||
@class CPTableView
|
||||
|
||||
CPTableColumnNoResizing = 0;
|
||||
CPTableColumnAutoresizingMask = 1 << 0;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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. */
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
@import <Foundation/CPKeyedUnarchiver.j>
|
||||
|
||||
@class CPView
|
||||
@class _CPThemeAttribute
|
||||
|
||||
var CPThemesByName = { },
|
||||
CPThemeDefaultTheme = nil,
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
@import "CPTextField.j"
|
||||
@import "CPWindow_Constants.j"
|
||||
|
||||
@class _CPTokenFieldTokenCloseButton
|
||||
@class _CPTokenFieldTokenDisclosureButton
|
||||
|
||||
@global CPApp
|
||||
@global CPTextFieldDidFocusNotification
|
||||
@global CPTextFieldDidBlurNotification
|
||||
|
||||
+3
-1
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
||||
CPScrollView _scrollView;
|
||||
CPView _frameView;
|
||||
|
||||
IFrame _iframe;
|
||||
DOMElement _iframe;
|
||||
CPString _mainFrameURL;
|
||||
CPArray _backwardStack;
|
||||
CPArray _forwardStack;
|
||||
|
||||
@@ -50,9 +50,15 @@
|
||||
|
||||
@class CPMenu
|
||||
@class CPProgressIndicator
|
||||
@class CPToolbar
|
||||
@class CPWindowController
|
||||
@class _CPWindowFrameAnimation
|
||||
|
||||
@global CPApp
|
||||
|
||||
@typedef _CPWindowFullPlatformWindowSession
|
||||
|
||||
|
||||
@protocol CPWindowDelegate <CPObject>
|
||||
|
||||
@optional
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
@import "CGGeometry.j"
|
||||
|
||||
@typedef CGAffineTransform
|
||||
|
||||
|
||||
function CGAffineTransformMake(a, b, c, d, tx, ty)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
@typedef CGColorSpace
|
||||
|
||||
kCGColorSpaceModelUnknown = -1;
|
||||
kCGColorSpaceModelMonochrome = 0;
|
||||
kCGColorSpaceModelRGB = 1;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
@import "CGGeometry.j"
|
||||
@import "CGPath.j"
|
||||
|
||||
@typedef CGContext
|
||||
|
||||
kCGLineCapButt = 0;
|
||||
kCGLineCapRound = 1;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
@import "CGColor.j"
|
||||
@import "CGColorSpace.j"
|
||||
|
||||
@typedef CGGradient
|
||||
|
||||
kCGGradientDrawsBeforeStartLocation = 1 << 0;
|
||||
kCGGradientDrawsAfterEndLocation = 1 << 1;
|
||||
|
||||
@@ -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)
|
||||
|
||||
/*!
|
||||
@}
|
||||
*/
|
||||
*/
|
||||
@@ -27,9 +27,12 @@
|
||||
|
||||
@class CPMenu
|
||||
@class CPPlatformPasteboard
|
||||
@class CPWindow
|
||||
|
||||
@global CPApp
|
||||
|
||||
@typedef DOMWindow
|
||||
|
||||
var PrimaryPlatformWindow = NULL;
|
||||
|
||||
@implementation CPPlatformWindow : CPObject
|
||||
|
||||
@@ -71,7 +71,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
DOMElement _DOMImageElement;
|
||||
DOMELement _DOMTextElement;
|
||||
DOMElement _DOMTextElement;
|
||||
DOMElement _DOMTextShadowElement;
|
||||
#endif
|
||||
}
|
||||
|
||||
+107
-107
@@ -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
|
||||
@@ -26,6 +26,7 @@
|
||||
@import "CPImage.j"
|
||||
@import "CPView.j"
|
||||
|
||||
@class CPToolbar
|
||||
@global CPApp
|
||||
|
||||
CPToolbarItemVisibilityPriorityStandard = 0;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+34
-32
@@ -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
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
@import "_CGGeometry.j"
|
||||
|
||||
@typedef CPRectEdge
|
||||
CPMinXEdge = 0;
|
||||
CPMinYEdge = 1;
|
||||
CPMaxXEdge = 2;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
@import "CPException.j"
|
||||
@import "CPObject.j"
|
||||
@import "CPRunLoop.j"
|
||||
@import "CPURLRequest.j"
|
||||
|
||||
CPJSONPConnectionCallbacks = {};
|
||||
|
||||
|
||||
+146
-145
@@ -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];
|
||||
};
|
||||
@@ -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;
|
||||
|
||||
@@ -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 <CPObject>
|
||||
{
|
||||
Class isa;
|
||||
id isa;
|
||||
}
|
||||
|
||||
+ (void)load
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
@import "_CPPredicate.j"
|
||||
|
||||
|
||||
var CPComparisonPredicateModifier,
|
||||
CPPredicateOperatorType;
|
||||
@typedef CPComparisonPredicateModifier
|
||||
@typedef CPPredicateOperatorType
|
||||
|
||||
/*!
|
||||
@ingroup foundation
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
@import "CPArray.j"
|
||||
@import "_CPPredicate.j"
|
||||
|
||||
var CPCompoundPredicateType;
|
||||
@typedef CPCompoundPredicateType
|
||||
|
||||
/*!
|
||||
@class CPCompoundPredicate
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
@{
|
||||
*/
|
||||
|
||||
@typedef CPRange
|
||||
|
||||
/*!
|
||||
Makes a CPRange.
|
||||
@param location the location for new range
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
@import "CPURLRequest.j"
|
||||
@import "CPURLResponse.j"
|
||||
|
||||
@typedef HTTPRequest
|
||||
|
||||
var CPURLConnectionDelegate = nil;
|
||||
|
||||
/*!
|
||||
|
||||
@@ -50,7 +50,7 @@ var _CPUndoGroupingPool = [],
|
||||
/* @ignore */
|
||||
@implementation _CPUndoGrouping : CPObject
|
||||
{
|
||||
_CPUndoGrouping _parent;
|
||||
id _parent;
|
||||
CPMutableArray _invocations;
|
||||
CPString _actionName;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
@import "CPObject.j"
|
||||
@import "CPString.j"
|
||||
|
||||
@typedef CPUserSessionStatus
|
||||
CPUserSessionUndeterminedStatus = 0;
|
||||
CPUserSessionLoggedInStatus = 1;
|
||||
CPUserSessionLoggedOutStatus = 2;
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user