mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-07 19:27:12 +00:00
Merge branch 'master' of github.com:cappuccino/cappuccino
This commit is contained in:
@@ -5,6 +5,7 @@ Demos
|
||||
./Aristo
|
||||
WebSite
|
||||
.push-package
|
||||
*.xcodeproj*
|
||||
*.xcodeproj/*.pbxuser
|
||||
*.xcodeproj/*.perspectivev3
|
||||
xcuserdata/
|
||||
@@ -15,3 +16,4 @@ xcuserdata/
|
||||
Tests/Manual/**/*.xcodeproj
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
*.tm_properties
|
||||
|
||||
@@ -448,7 +448,7 @@ var CPMainCibFile = @"CPMainCibFile",
|
||||
[CPPlatform activateIgnoringOtherApps:shouldIgnoreOtherApps];
|
||||
_isActive = YES;
|
||||
|
||||
[self _willResignActive];
|
||||
[self _didBecomeActive];
|
||||
}
|
||||
|
||||
- (void)deactivate
|
||||
@@ -986,7 +986,9 @@ var CPMainCibFile = @"CPMainCibFile",
|
||||
return;
|
||||
}
|
||||
|
||||
[aSheet._windowView _enableSheet:YES inWindow:aWindow];
|
||||
if (![aWindow attachedSheet])
|
||||
[aSheet._windowView _enableSheet:YES inWindow:aWindow];
|
||||
|
||||
[aWindow _attachSheet:aSheet modalDelegate:aModalDelegate didEndSelector:didEndSelector contextInfo:contextInfo];
|
||||
}
|
||||
|
||||
@@ -1173,7 +1175,7 @@ var CPMainCibFile = @"CPMainCibFile",
|
||||
[[self keyWindow] orderFront:self];
|
||||
else if ([self mainWindow])
|
||||
[[self mainWindow] makeKeyAndOrderFront:self];
|
||||
else
|
||||
else if ([self mainMenu])
|
||||
[[self mainMenu]._menuWindow makeKeyWindow]; //FIXME this may not actually work
|
||||
|
||||
_previousKeyWindow = nil;
|
||||
|
||||
+16
-5
@@ -108,7 +108,6 @@ CPButtonImageOffset = 3.0;
|
||||
|
||||
// NS-style Display Properties
|
||||
CPBezelStyle _bezelStyle;
|
||||
CPControlSize _controlSize;
|
||||
|
||||
CPString _keyEquivalent;
|
||||
unsigned _keyEquivalentModifierMask;
|
||||
@@ -189,8 +188,6 @@ CPButtonImageOffset = 3.0;
|
||||
|
||||
- (void)_init
|
||||
{
|
||||
_controlSize = CPRegularControlSize;
|
||||
|
||||
_keyEquivalent = @"";
|
||||
_keyEquivalentModifierMask = 0;
|
||||
|
||||
@@ -201,6 +198,20 @@ CPButtonImageOffset = 3.0;
|
||||
[self setButtonType:CPMomentaryPushInButton];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Control Size
|
||||
|
||||
- (void)setControlSize:(CPControlSize)aControlSize
|
||||
{
|
||||
[super setControlSize:aControlSize];
|
||||
|
||||
if ([self isBordered])
|
||||
[self _sizeToControlSize];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
// Setting the state
|
||||
/*!
|
||||
Returns a Boolean value indicating whether the button allows a mixed state.
|
||||
@@ -654,10 +665,10 @@ CPButtonImageOffset = 3.0;
|
||||
*/
|
||||
- (void)sizeToFit
|
||||
{
|
||||
[self layoutSubviews];
|
||||
|
||||
[self setFrameSize:[self _minimumFrameSize]];
|
||||
|
||||
[self layoutSubviews];
|
||||
|
||||
if ([self ephemeralSubviewNamed:@"content-view"])
|
||||
[self layoutSubviews];
|
||||
}
|
||||
|
||||
+31
-4
@@ -26,7 +26,10 @@
|
||||
@class CPSplitView
|
||||
|
||||
@global CPPopUpButtonStatePullsDown
|
||||
|
||||
@global CPKeyValueChangeOldKey
|
||||
@global CPKeyValueChangeNewKey
|
||||
@global CPKeyValueObservingOptionNew
|
||||
@global CPKeyValueObservingOptionOld
|
||||
|
||||
@implementation CPButtonBar : CPView
|
||||
{
|
||||
@@ -129,10 +132,20 @@
|
||||
|
||||
- (void)setButtons:(CPArray)buttons
|
||||
{
|
||||
for (var i = [_buttons count] - 1; i >= 0; i--)
|
||||
{
|
||||
[_buttons[i] removeFromSuperview];
|
||||
[_buttons[i] removeObserver:self forKeyPath:@"hidden"];
|
||||
}
|
||||
|
||||
|
||||
_buttons = [CPArray arrayWithArray:buttons];
|
||||
|
||||
for (var i = 0, count = [_buttons count]; i < count; i++)
|
||||
for (var i = [_buttons count] - 1; i >= 0; i--)
|
||||
{
|
||||
[_buttons[i] addObserver:self forKeyPath:@"hidden" options:CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld context:nil];
|
||||
[_buttons[i] setBordered:YES];
|
||||
}
|
||||
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
@@ -218,8 +231,14 @@
|
||||
count = [buttonsNotHidden count];
|
||||
|
||||
while (count--)
|
||||
if ([buttonsNotHidden[count] isHidden])
|
||||
[buttonsNotHidden removeObject:buttonsNotHidden[count]];
|
||||
{
|
||||
var button = buttonsNotHidden[count];
|
||||
|
||||
[button removeFromSuperview];
|
||||
|
||||
if ([button isHidden])
|
||||
[buttonsNotHidden removeObject:button];
|
||||
}
|
||||
|
||||
var currentButtonOffset = _resizeControlIsLeftAligned ? CGRectGetMaxX([self bounds]) + 1 : -1,
|
||||
bounds = [self bounds],
|
||||
@@ -274,6 +293,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(CPString)keyPath ofObject:(id)object change:(CPDictionary)change context:(id)context
|
||||
{
|
||||
if ([change objectForKey:CPKeyValueChangeOldKey] == [change objectForKey:CPKeyValueChangeNewKey])
|
||||
return;
|
||||
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)setFrameSize:(CGSize)aSize
|
||||
{
|
||||
[super setFrameSize:aSize];
|
||||
|
||||
+38
-12
@@ -47,18 +47,7 @@
|
||||
|
||||
if (_documentView)
|
||||
{
|
||||
var defaultCenter = [CPNotificationCenter defaultCenter];
|
||||
|
||||
[defaultCenter
|
||||
removeObserver:self
|
||||
name:CPViewFrameDidChangeNotification
|
||||
object:_documentView];
|
||||
|
||||
[defaultCenter
|
||||
removeObserver:self
|
||||
name:CPViewBoundsDidChangeNotification
|
||||
object:_documentView];
|
||||
|
||||
[self _removeObserverDocumentView:_documentView];
|
||||
[_documentView removeFromSuperview];
|
||||
}
|
||||
|
||||
@@ -91,6 +80,43 @@
|
||||
object:_documentView];
|
||||
}
|
||||
|
||||
- (void)_removeObserverDocumentView:(CPView)aDocumentView
|
||||
{
|
||||
var defaultCenter = [CPNotificationCenter defaultCenter];
|
||||
|
||||
[defaultCenter
|
||||
removeObserver:self
|
||||
name:CPViewFrameDidChangeNotification
|
||||
object:_documentView];
|
||||
|
||||
[defaultCenter
|
||||
removeObserver:self
|
||||
name:CPViewBoundsDidChangeNotification
|
||||
object:_documentView];
|
||||
}
|
||||
|
||||
- (void)_addObservers
|
||||
{
|
||||
if (_isObserving)
|
||||
return;
|
||||
|
||||
[super _addObservers];
|
||||
|
||||
if (_documentView)
|
||||
[self _observeDocumentView];
|
||||
}
|
||||
|
||||
- (void)_removeObservers
|
||||
{
|
||||
if (!_isObserving)
|
||||
return;
|
||||
|
||||
[super _removeObservers];
|
||||
|
||||
if (_documentView)
|
||||
[self _removeObserverDocumentView:_documentView];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the document view.
|
||||
*/
|
||||
|
||||
@@ -40,9 +40,8 @@ var CPCollectionViewDelegate_collectionView_acceptDrop_index_dropOperation_
|
||||
CPCollectionViewDelegate_collectionView_dataForItemsAtIndexes_forType_ = 1 << 4,
|
||||
CPCollectionViewDelegate_collectionView_validateDrop_proposedIndex_dropOperation_ = 1 << 5,
|
||||
CPCollectionViewDelegate_collectionView_didDoubleClickOnItemAtIndex_ = 1 << 6,
|
||||
CPCollectionViewDelegate_collectionViewDidChangeSelection_ = 1 << 7,
|
||||
CPCollectionViewDelegate_collectionView_menuForItemAtIndex_ = 1 << 8,
|
||||
CPCollectionViewDelegate_collectionView_draggingViewForItemsAtIndexes_withEvent_offset = 1 << 9;
|
||||
CPCollectionViewDelegate_collectionView_menuForItemAtIndex_ = 1 << 7,
|
||||
CPCollectionViewDelegate_collectionView_draggingViewForItemsAtIndexes_withEvent_offset = 1 << 8;
|
||||
|
||||
|
||||
@protocol CPCollectionViewDelegate <CPObject>
|
||||
@@ -57,7 +56,6 @@ var CPCollectionViewDelegate_collectionView_acceptDrop_index_dropOperation_
|
||||
- (CPMenu)collectionView:(CPCollectionView)collectionView menuForItemAtIndex:(CPInteger)anIndex;
|
||||
- (CPView)collectionView:(CPCollectionView)collectionView dragginViewForItemsAtIndexes:(CPIndexSet)indexes withEvent:(CPEvent)event offset:(CGPoint)dragImageOffset;
|
||||
- (void)collectionView:(CPCollectionView)collectionView didDoubleClickOnItemAtIndex:(int)index;
|
||||
- (void)collectionViewDidChangeSelection:(CPCollectionView)collectionView;
|
||||
|
||||
@end
|
||||
|
||||
@@ -71,10 +69,6 @@ var CPCollectionViewDelegate_collectionView_acceptDrop_index_dropOperation_
|
||||
|
||||
@par Delegate Methods
|
||||
|
||||
@delegate - (void)collectionViewDidChangeSelection:(CPCollectionView)collectionView;
|
||||
DEPRECATED: Please do not use.
|
||||
@param collectionView the collection view who's selection changed
|
||||
|
||||
@delegate - (void)collectionView:(CPCollectionView)collectionView didDoubleClickOnItemAtIndex:(int)index;
|
||||
Called when the user double-clicks on an item in the collection view.
|
||||
@param collectionView the collection view that received the double-click
|
||||
@@ -236,9 +230,6 @@ var HORIZONTAL_MARGIN = 2;
|
||||
if ([_delegate respondsToSelector:@selector(collectionView:didDoubleClickOnItemAtIndex:)])
|
||||
_implementedDelegateMethods |= CPCollectionViewDelegate_collectionView_didDoubleClickOnItemAtIndex_;
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(collectionViewDidChangeSelection:)])
|
||||
_implementedDelegateMethods |= CPCollectionViewDelegate_collectionViewDidChangeSelection_;
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(collectionView:menuForItemAtIndex:)])
|
||||
_implementedDelegateMethods |= CPCollectionViewDelegate_collectionView_menuForItemAtIndex_;
|
||||
|
||||
@@ -473,12 +464,6 @@ var HORIZONTAL_MARGIN = 2;
|
||||
|
||||
var binderClass = [[self class] _binderClassForBinding:@"selectionIndexes"];
|
||||
[[binderClass getBinding:@"selectionIndexes" forObject:self] reverseSetValueFor:@"selectionIndexes"];
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(collectionViewDidChangeSelection:)])
|
||||
{
|
||||
CPLog.warn("The delegate method collectionViewDidChangeSelection: is deprecated and will be removed in a future version, please bind to selectionIndexes instead.");
|
||||
[_delegate collectionViewDidChangeSelection:self];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -623,7 +608,7 @@ var HORIZONTAL_MARGIN = 2;
|
||||
|
||||
height = MAX(height, numberOfRows * (_minItemSize.height + _verticalMargin));
|
||||
|
||||
var itemSizeHeight = FLOOR(height / numberOfRows);
|
||||
var itemSizeHeight = FLOOR(height / numberOfRows) - _verticalMargin;
|
||||
|
||||
if (maxItemSizeHeight > 0)
|
||||
itemSizeHeight = MIN(itemSizeHeight, maxItemSizeHeight);
|
||||
@@ -1514,17 +1499,6 @@ Not supported. Use -collectionView:dataForItemsAtIndexes:fortype:
|
||||
return [_delegate collectionView:self didDoubleClickOnItemAtIndex:index];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
Call delegate collectionViewDidChangeSelection
|
||||
*/
|
||||
- (void)_sendDelegateCollectionViewDidChangeSelection:(CPCollectionView)collectionView
|
||||
{
|
||||
if (!(_implementedDelegateMethods & CPCollectionViewDelegate_collectionViewDidChangeSelection_))
|
||||
return;
|
||||
|
||||
return [_delegate collectionViewDidChangeSelection:self];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
|
||||
+39
-5
@@ -86,14 +86,12 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
|
||||
_active = NO;
|
||||
_color = [CPColor whiteColor];
|
||||
[self setBordered:YES];
|
||||
|
||||
[self _registerForNotifications];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)_registerForNotifications
|
||||
- (void)_registerNotifications
|
||||
{
|
||||
var defaultCenter = [CPNotificationCenter defaultCenter];
|
||||
|
||||
@@ -110,6 +108,22 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
|
||||
object:[CPColorPanel sharedColorPanel]];
|
||||
}
|
||||
|
||||
- (void)_removeNotifications
|
||||
{
|
||||
var defaultCenter = [CPNotificationCenter defaultCenter];
|
||||
|
||||
[defaultCenter
|
||||
removeObserver:self
|
||||
name:_CPColorWellDidBecomeExclusiveNotification
|
||||
object:nil];
|
||||
|
||||
[defaultCenter
|
||||
removeObserver:self
|
||||
name:CPWindowWillCloseNotification
|
||||
object:[CPColorPanel sharedColorPanel]];
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets whether the color well is bordered.
|
||||
*/
|
||||
@@ -312,6 +326,28 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
|
||||
[contentBorderView setBackgroundColor:[self currentValueForThemeAttribute:@"content-border-color"]];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Observers method
|
||||
|
||||
- (void)_addObservers
|
||||
{
|
||||
if (_isObserving)
|
||||
return;
|
||||
|
||||
[super _addObservers];
|
||||
[self _registerNotifications];
|
||||
}
|
||||
|
||||
- (void)_removeObservers
|
||||
{
|
||||
if (!_isObserving)
|
||||
return;
|
||||
|
||||
[super _removeObservers];
|
||||
[self _removeNotifications];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPColorWellValueBinder : CPBinder
|
||||
@@ -363,8 +399,6 @@ var CPColorWellColorKey = "CPColorWellColorKey",
|
||||
_active = NO;
|
||||
_color = [aCoder decodeObjectForKey:CPColorWellColorKey];
|
||||
[self setBordered:[aCoder decodeBoolForKey:CPColorWellBorderedKey]];
|
||||
|
||||
[self _registerForNotifications];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
+50
-10
@@ -36,6 +36,15 @@
|
||||
|
||||
@end
|
||||
|
||||
@protocol CPComboBoxDataSource <CPObject>
|
||||
|
||||
@optional
|
||||
- (CPString)comboBox:(CPComboBox)aComboBox completedString:(CPString)uncompletedString;
|
||||
- (id)comboBox:(CPComboBox)aComboBox objectValueForItemAtIndex:(int)index;
|
||||
- (int)comboBox:(CPComboBox)aComboBox indexOfItemWithStringValue:(CPString)stringValue;
|
||||
- (int)numberOfItemsInComboBox:(CPComboBox)aComboBox;
|
||||
|
||||
@end
|
||||
|
||||
CPComboBoxSelectionDidChangeNotification = @"CPComboBoxSelectionDidChangeNotification";
|
||||
CPComboBoxSelectionIsChangingNotification = @"CPComboBoxSelectionIsChangingNotification";
|
||||
@@ -62,6 +71,8 @@ var CPComboBoxTextSubview = @"text",
|
||||
BOOL _forceSelection;
|
||||
BOOL _hasVerticalScroller;
|
||||
CPString _selectedStringValue;
|
||||
CGSize _intercellSpacing;
|
||||
float _itemHeight;
|
||||
BOOL _popUpButtonCausedResign;
|
||||
}
|
||||
|
||||
@@ -131,7 +142,9 @@ var CPComboBoxTextSubview = @"text",
|
||||
return;
|
||||
|
||||
_hasVerticalScroller = flag;
|
||||
[[_listDelegate scrollView] setHasVerticalScroller:flag];
|
||||
|
||||
if (_listDelegate)
|
||||
[[_listDelegate scrollView] setHasVerticalScroller:_hasVerticalScroller];
|
||||
}
|
||||
|
||||
- (CGSize)intercellSpacing
|
||||
@@ -141,7 +154,13 @@ var CPComboBoxTextSubview = @"text",
|
||||
|
||||
- (void)setIntercellSpacing:(CGSize)aSize
|
||||
{
|
||||
[[_listDelegate tableView] setIntercellSpacing:aSize];
|
||||
if (_intercellSpacing && CGSizeEqualToSize(aSize, _intercellSpacing))
|
||||
return;
|
||||
|
||||
_intercellSpacing = aSize;
|
||||
|
||||
if (_listDelegate)
|
||||
[[_listDelegate tableView] setIntercellSpacing:_intercellSpacing];
|
||||
}
|
||||
|
||||
- (BOOL)isButtonBordered
|
||||
@@ -164,10 +183,18 @@ var CPComboBoxTextSubview = @"text",
|
||||
|
||||
- (void)setItemHeight:(float)itemHeight
|
||||
{
|
||||
[[_listDelegate tableView] setRowHeight:itemHeight];
|
||||
if (itemHeight === _itemHeight)
|
||||
return;
|
||||
|
||||
// FIXME: This shouldn't be necessary, but CPTableView does not tile after setRowHeight
|
||||
[[_listDelegate tableView] reloadData];
|
||||
_itemHeight = itemHeight;
|
||||
|
||||
if (_listDelegate)
|
||||
{
|
||||
[[_listDelegate tableView] setRowHeight:_itemHeight];
|
||||
|
||||
// FIXME: This shouldn't be necessary, but CPTableView does not tile after setRowHeight
|
||||
[[_listDelegate tableView] reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
- (int)numberOfVisibleItems
|
||||
@@ -183,7 +210,7 @@ var CPComboBoxTextSubview = @"text",
|
||||
|
||||
#pragma mark Setting a Delegate
|
||||
|
||||
- (id /*< CPComboBoxDelegate >*/)delegate
|
||||
- (id <CPComboBoxDelegate>)delegate
|
||||
{
|
||||
return [super delegate];
|
||||
}
|
||||
@@ -243,7 +270,7 @@ var CPComboBoxTextSubview = @"text",
|
||||
|
||||
#pragma mark Setting a Data Source
|
||||
|
||||
- (id /*< CPComboBoxDataSource >*/)dataSource
|
||||
- (id <CPComboBoxDataSource>)dataSource
|
||||
{
|
||||
if (!_usesDataSource)
|
||||
[self _dataSourceWarningForMethod:_cmd condition:NO];
|
||||
@@ -251,10 +278,12 @@ var CPComboBoxTextSubview = @"text",
|
||||
return _dataSource;
|
||||
}
|
||||
|
||||
- (void)setDataSource:(id /*< CPComboBoxDataSource >*/)aSource
|
||||
- (void)setDataSource:(id <CPComboBoxDataSource>)aSource
|
||||
{
|
||||
if (!_usesDataSource)
|
||||
{
|
||||
[self _dataSourceWarningForMethod:_cmd condition:NO];
|
||||
}
|
||||
else if (_dataSource !== aSource)
|
||||
{
|
||||
if (![aSource respondsToSelector:@selector(numberOfItemsInComboBox:)] ||
|
||||
@@ -263,7 +292,9 @@ var CPComboBoxTextSubview = @"text",
|
||||
CPLog.warn("Illegal %s data source (%s). Must implement numberOfItemsInComboBox: and comboBox:objectValueForItemAtIndex:", [self className], [aSource description]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_dataSource = aSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,6 +469,9 @@ var CPComboBoxTextSubview = @"text",
|
||||
// Apply our text style to the list
|
||||
[_listDelegate setFont:[self font]];
|
||||
[_listDelegate setAlignment:[self alignment]];
|
||||
[[_listDelegate scrollView] setHasVerticalScroller:_hasVerticalScroller];
|
||||
[[_listDelegate tableView] setIntercellSpacing:_intercellSpacing];
|
||||
[[_listDelegate tableView] setRowHeight:_itemHeight];
|
||||
}
|
||||
|
||||
- (int)indexOfItemWithObjectValue:(id)anObject
|
||||
@@ -829,13 +863,17 @@ var CPComboBoxTextSubview = @"text",
|
||||
- (void)setFont:(CPFont)aFont
|
||||
{
|
||||
[super setFont:aFont];
|
||||
[_listDelegate setFont:aFont];
|
||||
|
||||
if (_listDelegate)
|
||||
[_listDelegate setFont:aFont];
|
||||
}
|
||||
|
||||
- (void)setAlignment:(CPTextAlignment)alignment
|
||||
{
|
||||
[super setAlignment:alignment];
|
||||
[_listDelegate setAlignment:alignment];
|
||||
|
||||
if (_listDelegate)
|
||||
[_listDelegate setAlignment:alignment];
|
||||
}
|
||||
|
||||
#pragma mark Pop Up Button Layout
|
||||
@@ -906,7 +944,9 @@ var CPComboBoxTextSubview = @"text",
|
||||
index = [_dataSource comboBox:self indexOfItemWithStringValue:stringValue]
|
||||
}
|
||||
else
|
||||
{
|
||||
index = [self indexOfItemWithObjectValue:stringValue];
|
||||
}
|
||||
|
||||
[_listDelegate selectRow:index];
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ CPInputOnInputEventFeature = 30;
|
||||
|
||||
CPFileAPIFeature = 31;
|
||||
|
||||
CPAltEnterTextAreaFeature = 32;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -100,6 +102,7 @@ var USER_AGENT = "",
|
||||
// default these features to true
|
||||
PLATFORM_FEATURES[CPInputTypeCanBeChangedFeature] = YES;
|
||||
PLATFORM_FEATURES[CPInputSetFontOutsideOfDOM] = YES;
|
||||
PLATFORM_FEATURES[CPAltEnterTextAreaFeature] = YES;
|
||||
|
||||
if (typeof window !== "undefined" && typeof window.navigator !== "undefined")
|
||||
USER_AGENT = window.navigator.userAgent;
|
||||
@@ -208,6 +211,7 @@ else if (USER_AGENT.indexOf("Gecko") !== -1) // Must follow KHTML check.
|
||||
// Some day this might be fixed and should be version prefixed. No known fixed version yet.
|
||||
PLATFORM_FEATURES[CPInput1PxLeftPadding] = YES;
|
||||
|
||||
PLATFORM_FEATURES[CPAltEnterTextAreaFeature] = NO;
|
||||
// This was supposed to be added in Firefox 22, but when testing with the latest beta as of 2013-06-14
|
||||
// it does not seem to work. It seems to exhibit the CPJavaScriptPasteRequiresEditableTarget problem,
|
||||
// and in addition doesn't seem to work with our native copy code either.
|
||||
|
||||
+96
-6
@@ -118,6 +118,8 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
BOOL _trackingWasWithinFrame;
|
||||
unsigned _trackingMouseDownFlags;
|
||||
CGPoint _previousTrackingLocation;
|
||||
|
||||
CPControlSize _controlSize;
|
||||
}
|
||||
|
||||
+ (CPDictionary)themeAttributes
|
||||
@@ -134,6 +136,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
@"image-scaling": CPScaleToFit,
|
||||
@"min-size": CGSizeMakeZero(),
|
||||
@"max-size": CGSizeMake(-1.0, -1.0),
|
||||
@"nib2cib-adjustment-frame": CGRectMakeZero()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -189,13 +192,95 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_sendActionOn = CPLeftMouseUpMask;
|
||||
_sendActionOn = CPLeftMouseUpMask;
|
||||
_trackingMouseDownFlags = 0;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Control Size
|
||||
|
||||
/*!
|
||||
Returns the control's control size
|
||||
*/
|
||||
- (CPControlSize)controlSize
|
||||
{
|
||||
return _controlSize;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the control's size.
|
||||
@param aControlSize the control's size
|
||||
*/
|
||||
- (void)setControlSize:(CPControlSize)aControlSize
|
||||
{
|
||||
if (_controlSize === aControlSize)
|
||||
return;
|
||||
|
||||
[self unsetThemeState:[self _controlSizeThemeState]];
|
||||
_controlSize = aControlSize;
|
||||
[self setThemeState:[self _controlSizeThemeState]];
|
||||
|
||||
[self setNeedsLayout];
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
/*!
|
||||
Gets the current theme state according to the current controlSize.
|
||||
@return a CPThemeState
|
||||
*/
|
||||
- (ThemeState)_controlSizeThemeState
|
||||
{
|
||||
switch(_controlSize)
|
||||
{
|
||||
case CPSmallControlSize:
|
||||
return CPThemeStateControlSizeSmall;
|
||||
|
||||
case CPMiniControlSize:
|
||||
return CPThemeStateControlSizeMini;
|
||||
|
||||
case CPRegularControlSize:
|
||||
default:
|
||||
return CPThemeStateControlSizeRegular;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
Change frame size according to the theme control size theme constraints
|
||||
Basically for height to min-size.
|
||||
*/
|
||||
- (void)_sizeToControlSize
|
||||
{
|
||||
var frameSize = [self frameSize],
|
||||
minSize = [self currentValueForThemeAttribute:@"min-size"],
|
||||
maxSize = [self currentValueForThemeAttribute:@"max-size"];
|
||||
|
||||
if (minSize.width > 0)
|
||||
{
|
||||
frameSize.width = MAX(minSize.width, frameSize.width);
|
||||
|
||||
if (maxSize.width > 0)
|
||||
frameSize.width = MIN(maxSize.width, frameSize.width);
|
||||
}
|
||||
|
||||
if (minSize.height > 0)
|
||||
{
|
||||
frameSize.height = MAX(minSize.height, frameSize.height);
|
||||
|
||||
if (maxSize.height > 0)
|
||||
frameSize.height = MIN(maxSize.height, frameSize.height);
|
||||
}
|
||||
|
||||
[self setFrameSize:frameSize];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
Sets the receiver's target action.
|
||||
|
||||
@@ -927,14 +1012,15 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
|
||||
@end
|
||||
|
||||
var CPControlValueKey = @"CPControlValueKey",
|
||||
var CPControlActionKey = @"CPControlActionKey",
|
||||
CPControlControlSizeKey = @"CPControlControlSizeKey",
|
||||
CPControlControlStateKey = @"CPControlControlStateKey",
|
||||
CPControlIsEnabledKey = @"CPControlIsEnabledKey",
|
||||
CPControlTargetKey = @"CPControlTargetKey",
|
||||
CPControlActionKey = @"CPControlActionKey",
|
||||
CPControlSendActionOnKey = @"CPControlSendActionOnKey",
|
||||
CPControlFormatterKey = @"CPControlFormatterKey",
|
||||
CPControlIsEnabledKey = @"CPControlIsEnabledKey",
|
||||
CPControlSendActionOnKey = @"CPControlSendActionOnKey",
|
||||
CPControlSendsActionOnEndEditingKey = @"CPControlSendsActionOnEndEditingKey",
|
||||
CPControlTargetKey = @"CPControlTargetKey",
|
||||
CPControlValueKey = @"CPControlValueKey",
|
||||
|
||||
__Deprecated__CPImageViewImageKey = @"CPImageViewImageKey";
|
||||
|
||||
@@ -961,6 +1047,8 @@ var CPControlValueKey = @"CPControlValueKey",
|
||||
[self setSendsActionOnEndEditing:[aCoder decodeBoolForKey:CPControlSendsActionOnEndEditingKey]];
|
||||
|
||||
[self setFormatter:[aCoder decodeObjectForKey:CPControlFormatterKey]];
|
||||
|
||||
[self setControlSize:[aCoder decodeIntForKey:CPControlControlSizeKey]];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -993,6 +1081,8 @@ var CPControlValueKey = @"CPControlValueKey",
|
||||
|
||||
if (_formatter !== nil)
|
||||
[aCoder encodeObject:_formatter forKey:CPControlFormatterKey];
|
||||
|
||||
[aCoder encodeInt:_controlSize forKey:CPControlControlSizeKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
@import <Foundation/CPArray.j>
|
||||
@import <Foundation/CPObject.j>
|
||||
@import <Foundation/CPDate.j>
|
||||
@import <Foundation/CPDateFormatter.j>
|
||||
@import <Foundation/CPLocale.j>
|
||||
@import <Foundation/CPTimeZone.j>
|
||||
|
||||
@@ -76,6 +75,7 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
CPInteger _datePickerStyle @accessors(property=datePickerStyle);
|
||||
CPInteger _timeInterval @accessors(property=timeInterval);
|
||||
|
||||
BOOL _invokedByUserEvent;
|
||||
_CPDatePickerTextField _datePickerTextfield;
|
||||
_CPDatePickerCalendar _datePickerCalendar;
|
||||
unsigned _implementedCDatePickerDelegateMethods;
|
||||
@@ -207,14 +207,10 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
_locale = [CPLocale currentLocale];
|
||||
|
||||
_datePickerTextfield = [[_CPDatePickerTextField alloc] initWithFrame:[self bounds] withDatePicker:self];
|
||||
|
||||
[_datePickerTextfield setDateValue:_dateValue];
|
||||
[self addSubview:_datePickerTextfield];
|
||||
|
||||
_datePickerCalendar = [[_CPDatePickerCalendar alloc] initWithFrame:[self bounds] withDatePicker:self];
|
||||
[_datePickerCalendar setDateValue:_dateValue];
|
||||
[_datePickerCalendar setHidden:YES];
|
||||
[self addSubview:_datePickerCalendar];
|
||||
|
||||
// We might have been unarchived in a disabled state.
|
||||
[_datePickerTextfield setEnabled:[self isEnabled]];
|
||||
@@ -224,6 +220,18 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Control Size
|
||||
|
||||
- (void)setControlSize:(CPControlSize)aControlSize
|
||||
{
|
||||
[super setControlSize:aControlSize];
|
||||
|
||||
if ([self datePickerStyle] == CPTextFieldAndStepperDatePickerStyle || [self datePickerStyle] == CPTextFieldDatePickerStyle)
|
||||
[self _sizeToControlSize];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Delegate methods
|
||||
|
||||
@@ -252,15 +260,26 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
|
||||
if (_datePickerStyle == CPTextFieldAndStepperDatePickerStyle || _datePickerStyle == CPTextFieldDatePickerStyle)
|
||||
{
|
||||
[_datePickerTextfield setHidden:NO];
|
||||
[_datePickerCalendar setHidden:YES];
|
||||
if (![_datePickerTextfield superview])
|
||||
[self addSubview:_datePickerTextfield];
|
||||
|
||||
if ([_datePickerCalendar superview])
|
||||
[_datePickerCalendar removeFromSuperview];
|
||||
|
||||
[_datePickerTextfield setControlSize:[self controlSize]];
|
||||
[_datePickerTextfield setNeedsLayout];
|
||||
[_datePickerTextfield setNeedsDisplay:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_datePickerCalendar setHidden:NO];
|
||||
[_datePickerTextfield setHidden:YES];
|
||||
if (![_datePickerCalendar superview])
|
||||
[self addSubview:_datePickerCalendar];
|
||||
|
||||
if ([_datePickerTextfield superview])
|
||||
[_datePickerTextfield removeFromSuperview];
|
||||
|
||||
[_datePickerCalendar setNeedsLayout];
|
||||
[_datePickerCalendar setNeedsDisplay:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,11 +294,14 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
return _dateValue
|
||||
}
|
||||
|
||||
/*! Set the objectValue ofhe datePier. It has to be a CPDate
|
||||
/*! Set the objectValue of the datePicker. It has to be a CPDate
|
||||
@param aDateValue the dateValue
|
||||
*/
|
||||
- (void)setObjectValue:(CPDate)aValue
|
||||
{
|
||||
if (![aValue isKindOfClass:[CPDate class]])
|
||||
return;
|
||||
|
||||
[self setDateValue:aValue];
|
||||
}
|
||||
|
||||
@@ -291,6 +313,7 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
if (aDateValue == nil)
|
||||
return;
|
||||
|
||||
_invokedByUserEvent = NO;
|
||||
[self _setDateValue:aDateValue timeInterval:_timeInterval];
|
||||
}
|
||||
|
||||
@@ -338,7 +361,8 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
_timeInterval = (_datePickerMode == CPSingleDateMode)? 0 : aTimeInterval;
|
||||
[self didChangeValueForKey:@"timeInterval"];
|
||||
|
||||
[self sendAction:[self action] to:[self target]];
|
||||
if (_invokedByUserEvent)
|
||||
[self sendAction:[self action] to:[self target]];
|
||||
|
||||
if (_datePickerStyle == CPTextFieldAndStepperDatePickerStyle || _datePickerStyle == CPTextFieldDatePickerStyle)
|
||||
[_datePickerTextfield setDateValue:_dateValue];
|
||||
@@ -377,6 +401,8 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
{
|
||||
_datePickerStyle = aDatePickerStyle;
|
||||
|
||||
[self setControlSize:[self controlSize]];
|
||||
|
||||
[self setNeedsDisplay:YES];
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
@@ -537,6 +563,7 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
return NO;
|
||||
|
||||
[_datePickerTextfield _selectTextFieldWithFlags:[[CPApp currentEvent] modifierFlags]];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -644,12 +671,13 @@ var CPDatePickerModeKey = @"CPDatePickerModeKey",
|
||||
_timeInterval = [aCoder decodeDoubleForKey:CPIntervalKey];
|
||||
_datePickerMode = [aCoder decodeIntForKey:CPDatePickerModeKey];
|
||||
_datePickerElements = [aCoder decodeIntForKey:CPDatePickerElementsKey];
|
||||
_datePickerStyle = [aCoder decodeIntForKey:CPDatePickerStyleKey];
|
||||
[self setDatePickerStyle:[aCoder decodeIntForKey:CPDatePickerStyleKey]];
|
||||
_locale = [aCoder decodeObjectForKey:CPLocaleKey];
|
||||
_dateValue = [aCoder decodeObjectForKey:CPDateValueKey];
|
||||
_backgroundColor = [aCoder decodeObjectForKey:CPBackgroundColorKey];
|
||||
_drawsBackground = [aCoder decodeBoolForKey:CPDrawsBackgroundKey];
|
||||
_isBordered = [aCoder decodeBoolForKey:CPBorderedKey];
|
||||
|
||||
[self _init];
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
_datePicker = aDatePicker
|
||||
[self _init];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -215,6 +216,8 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
[_headerView setHidden:YES];
|
||||
[_monthView setHidden:YES];
|
||||
}
|
||||
|
||||
[self setFrameSize:[_datePicker frameSize]];
|
||||
}
|
||||
|
||||
|
||||
@@ -381,9 +384,11 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
|
||||
[_previousButton setTarget:aDelegate];
|
||||
[_previousButton setAction:@selector(_clickArrowPrevious:)];
|
||||
[_previousButton setContinuous:YES];
|
||||
|
||||
[_nextButton setTarget:aDelegate];
|
||||
[_nextButton setAction:@selector(_clickArrowNext:)];
|
||||
[_nextButton setContinuous:YES];
|
||||
|
||||
[_currentButton setTarget:aDelegate];
|
||||
[_currentButton setAction:@selector(_currentMonth:)];
|
||||
@@ -891,6 +896,8 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
_indexDayTile = -1;
|
||||
_eventDragged = nil
|
||||
|
||||
_datePicker._invokedByUserEvent = YES;
|
||||
|
||||
// Check if we have to change or not the month of the component
|
||||
if ([dayTile date].getMonth() == _date.getMonth())
|
||||
{
|
||||
@@ -943,6 +950,8 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
else
|
||||
[_delegate _displayNextMonth];
|
||||
}
|
||||
|
||||
_datePicker._invokedByUserEvent = NO;
|
||||
}
|
||||
|
||||
/*! Mouse dragged event
|
||||
@@ -960,6 +969,8 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
_indexDayTile = [self indexOfTileForEvent:anEvent];
|
||||
_eventDragged = anEvent;
|
||||
|
||||
_datePicker._invokedByUserEvent = YES;
|
||||
|
||||
if ([_datePicker datePickerMode] == CPSingleDateMode)
|
||||
{
|
||||
// Check if we have to change or not the month of the component
|
||||
@@ -1001,6 +1012,8 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
[_datePicker _setDateValue:[self _hoursMinutesSecondsFromDatePickerForDate:_clickDate] timeInterval:[dateTile timeIntervalSinceDate:dateValueAtMidnight]];
|
||||
}
|
||||
}
|
||||
|
||||
_datePicker._invokedByUserEvent = NO;
|
||||
}
|
||||
|
||||
- (void)mouseUp:(CPEvent)anEvent
|
||||
@@ -1258,14 +1271,6 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
CPDatePicker _datePicker @accessors(property=datePicker);
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)aRect
|
||||
{
|
||||
[super drawRect:aRect];
|
||||
@@ -1279,10 +1284,10 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
CGContextSetStrokeColor(context, [_datePicker valueForThemeAttribute:@"border-color" inState:[_datePicker themeState]]);
|
||||
CGContextSetLineWidth(context, [_datePicker valueForThemeAttribute:@"border-width"]);
|
||||
|
||||
CGContextMoveToPoint(context, borderWidth,borderWidth);
|
||||
CGContextAddLineToPoint(context, aRect.size.width - borderWidth,borderWidth);
|
||||
CGContextAddLineToPoint(context, aRect.size.width - borderWidth,aRect.size.height - borderWidth);
|
||||
CGContextAddLineToPoint(context, borderWidth,aRect.size.height - borderWidth);
|
||||
CGContextMoveToPoint(context, borderWidth, borderWidth);
|
||||
CGContextAddLineToPoint(context, aRect.size.width - borderWidth, borderWidth);
|
||||
CGContextAddLineToPoint(context, aRect.size.width - borderWidth, aRect.size.height - borderWidth);
|
||||
CGContextAddLineToPoint(context, borderWidth, aRect.size.height - borderWidth);
|
||||
CGContextAddLineToPoint(context, borderWidth,borderWidth);
|
||||
|
||||
CGContextStrokePath(context);
|
||||
@@ -1301,5 +1306,4 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
[self setBackgroundColor:[CPColor clearColor]];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -92,8 +92,6 @@ var CPZeroKeyCode = 48,
|
||||
[_stepper setAction:@selector(_clickStepper:)];
|
||||
[self addSubview:_stepper];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_datePickerElementTextFieldBecomeFirstResponder:) name:CPDatePickerElementTextFieldBecomeFirstResponder object:self];
|
||||
|
||||
[self setNeedsLayout];
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
@@ -365,7 +363,6 @@ var CPZeroKeyCode = 48,
|
||||
[_currentTextField setValueForKeyEvent:anEvent];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Layout methods
|
||||
|
||||
@@ -384,14 +381,16 @@ var CPZeroKeyCode = 48,
|
||||
// Check the mode to display or not the stepper
|
||||
if ([_datePicker datePickerStyle] == CPTextFieldAndStepperDatePickerStyle)
|
||||
{
|
||||
frameSize = CGSizeMake(CGRectGetWidth([_datePicker frame]) - CGRectGetWidth([_stepper frame]) - [_datePicker valueForThemeAttribute:@"stepper-margin"], CGRectGetHeight([_datePicker frame]));
|
||||
[_stepper setHidden:NO];
|
||||
[_stepper setControlSize:[_datePicker controlSize]];
|
||||
|
||||
frameSize = CGSizeMake(CGRectGetWidth([_datePicker frame]) - CGRectGetWidth([_stepper frame]) - [_datePicker currentValueForThemeAttribute:@"stepper-margin"], CGRectGetHeight([_datePicker frame]));
|
||||
|
||||
frameSize.width -= bezelInset.left;
|
||||
frameSize.height -= bezelInset.top + bezelInset.bottom;
|
||||
|
||||
[_datePickerElementView setFrameSize:frameSize];
|
||||
[_datePickerElementView setFrameOrigin:CGPointMake(bezelInset.left, bezelInset.top)];
|
||||
[_stepper setHidden:NO];
|
||||
}
|
||||
else if ([_datePicker datePickerStyle] == CPTextFieldDatePickerStyle)
|
||||
{
|
||||
@@ -405,11 +404,37 @@ var CPZeroKeyCode = 48,
|
||||
[_stepper setHidden:YES];
|
||||
}
|
||||
|
||||
[_stepper setFrameOrigin:CGPointMake(CGRectGetMaxX([_datePickerElementView frame]) + [_datePicker valueForThemeAttribute:@"stepper-margin"], bezelInset.top + CGRectGetHeight([_datePickerElementView frame]) / 2 - CGRectGetHeight([_stepper frame]) / 2)];
|
||||
[_stepper setFrameOrigin:CGPointMake(CGRectGetMaxX([_datePickerElementView frame]) + [_datePicker currentValueForThemeAttribute:@"stepper-margin"], bezelInset.top + CGRectGetHeight([_datePickerElementView frame]) / 2 - CGRectGetHeight([_stepper frame]) / 2)];
|
||||
|
||||
[_datePickerElementView setControlSize:[_datePicker controlSize]];
|
||||
|
||||
[_datePickerElementView setNeedsLayout];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Override observers
|
||||
|
||||
- (void)_removeObservers
|
||||
{
|
||||
if (!_isObserving)
|
||||
return;
|
||||
|
||||
[super _removeObservers];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPDatePickerElementTextFieldBecomeFirstResponder object:self];
|
||||
}
|
||||
|
||||
- (void)_addObservers
|
||||
{
|
||||
if (_isObserving)
|
||||
return;
|
||||
|
||||
[super _addObservers];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_datePickerElementTextFieldBecomeFirstResponder:) name:CPDatePickerElementTextFieldBecomeFirstResponder object:self];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -520,8 +545,6 @@ var CPZeroKeyCode = 48,
|
||||
[self addSubview: _textFieldSeparatorThree];
|
||||
[self addSubview: _textFieldSeparatorFour];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_datePickerElementTextFieldAMPMChangedNotification:) name:CPDatePickerElementTextFieldAMPMChangedNotification object:_textFieldPMAM];
|
||||
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
@@ -529,12 +552,91 @@ var CPZeroKeyCode = 48,
|
||||
#pragma mark -
|
||||
#pragma mark Responder methods
|
||||
|
||||
/*! @ignore */
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return NO;
|
||||
// This is needed to accept to be firstResponder when nothing is selected.
|
||||
// This element needs to be first responder when the CPDatePicker is in the CPTableView
|
||||
// When clicking on a row of a CPTableView where there isn't a date element, the CPTableView will ask this element to know if it can becomes or not a firstResponder.
|
||||
return [_datePicker isEnabled] && ![self superview]._currentTextField;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Override observers
|
||||
|
||||
- (void)_removeObservers
|
||||
{
|
||||
if (!_isObserving)
|
||||
return;
|
||||
|
||||
[super _removeObservers];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPDatePickerElementTextFieldAMPMChangedNotification object:_textFieldPMAM];
|
||||
}
|
||||
|
||||
- (void)_addObservers
|
||||
{
|
||||
if (_isObserving)
|
||||
return;
|
||||
|
||||
[super _addObservers];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_datePickerElementTextFieldAMPMChangedNotification:) name:CPDatePickerElementTextFieldAMPMChangedNotification object:_textFieldPMAM];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Mouse event
|
||||
|
||||
- (BOOL)continueTracking:(CGPoint)lastPoint at:(CGPoint)aPoint
|
||||
{
|
||||
[self _selectTextFieldForPoint:aPoint];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)startTrackingAt:(CGPoint)aPoint
|
||||
{
|
||||
[self _selectTextFieldForPoint:aPoint];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)_selectTextFieldForPoint:(CGPoint)aPoint
|
||||
{
|
||||
var textField = [self _textFieldForPoint:aPoint],
|
||||
superview = [self superview];
|
||||
|
||||
if (!textField || [superview._currentTextField] == textField)
|
||||
return;
|
||||
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPDatePickerElementTextFieldBecomeFirstResponder object:superview userInfo:[CPDictionary dictionaryWithObject:textField forKey:@"textField"]];
|
||||
}
|
||||
|
||||
- (_CPDatePickerElementTextField)_textFieldForPoint:(CGPoint)aPoint
|
||||
{
|
||||
if (![_textFieldDay isHidden] && CGRectContainsPoint([_textFieldDay frame], aPoint))
|
||||
return _textFieldDay;
|
||||
|
||||
if (![_textFieldMonth isHidden] && CGRectContainsPoint([_textFieldMonth frame], aPoint))
|
||||
return _textFieldMonth;
|
||||
|
||||
if (![_textFieldYear isHidden] && CGRectContainsPoint([_textFieldYear frame], aPoint))
|
||||
return _textFieldYear;
|
||||
|
||||
if (![_textFieldHour isHidden] && CGRectContainsPoint([_textFieldHour frame], aPoint))
|
||||
return _textFieldHour;
|
||||
|
||||
if (![_textFieldMinute isHidden] && CGRectContainsPoint([_textFieldMinute frame], aPoint))
|
||||
return _textFieldMinute;
|
||||
|
||||
if (![_textFieldSecond isHidden] && CGRectContainsPoint([_textFieldSecond frame], aPoint))
|
||||
return _textFieldSecond;
|
||||
|
||||
if (![_textFieldPMAM isHidden] && CGRectContainsPoint([_textFieldPMAM frame], aPoint))
|
||||
return _textFieldPMAM;
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Setter Getter methods
|
||||
|
||||
@@ -675,7 +777,9 @@ var CPZeroKeyCode = 48,
|
||||
dateValue.setHours(dateValue.getHours() - 12);
|
||||
}
|
||||
|
||||
[_datePicker setDateValue:dateValue];
|
||||
_datePicker._invokedByUserEvent = YES;
|
||||
[_datePicker _setDateValue:dateValue timeInterval:[_datePicker timeInterval]];
|
||||
_datePicker._invokedByUserEvent = NO;
|
||||
}
|
||||
|
||||
|
||||
@@ -702,6 +806,7 @@ var CPZeroKeyCode = 48,
|
||||
|
||||
[self _updateResponderTextField];
|
||||
[self _updateHiddenTextFields];
|
||||
[self _setControlSizes];
|
||||
[self _sizeToFit];
|
||||
[self _updatePositions];
|
||||
|
||||
@@ -738,183 +843,201 @@ var CPZeroKeyCode = 48,
|
||||
*/
|
||||
- (void)_themeTextFields
|
||||
{
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"min-size-datepicker-textfield"] forThemeAttribute:@"min-size"];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateNormal] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateSelected] forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateSelected] forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateNormal] forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:[_datePicker textColor] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateDisabled] forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldDay setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldDay setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
var disabledTextColor = [_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled],
|
||||
disabledTextFieldBezelColor = [_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateDisabled],
|
||||
disabledTextShadowColor = [_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled],
|
||||
disabledTextShadowOffset = [_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled],
|
||||
normalSeparatorContentInset = [_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield-separator" inState:CPThemeStateNormal],
|
||||
normalTextFieldBezelColor = [_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateNormal],
|
||||
normalTextFieldContentInset = [_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateNormal],
|
||||
normalTextShadowColor = [_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal],
|
||||
normalTextShadowOffset = [_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal],
|
||||
selectedSeparatorContentInset = [_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield-separator" inState:CPThemeStateSelected],
|
||||
selectedTextColor = [_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateSelected],
|
||||
selectedTextFieldBezelColor = [_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateSelected],
|
||||
selectedTextFieldContentInset = [_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateSelected],
|
||||
selectedTextShadowColor = [_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected],
|
||||
selectedTextShadowOffset = [_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected],
|
||||
textColor = [_datePicker textColor],
|
||||
textFieldMinSize = [_datePicker currentValueForThemeAttribute:@"min-size-datepicker-textfield"],
|
||||
textFont = [_datePicker textFont];
|
||||
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"min-size-datepicker-textfield"] forThemeAttribute:@"min-size"];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateNormal] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateSelected] forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateSelected] forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateNormal] forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:[_datePicker textColor] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateDisabled] forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMonth setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMonth setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
[_textFieldDay setValue:textFieldMinSize forThemeAttribute:@"min-size"];
|
||||
[_textFieldDay setValue:normalTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:selectedTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:selectedTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:selectedTextColor forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:selectedTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:selectedTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldDay setValue:normalTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:normalTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:normalTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldDay setValue:disabledTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldDay setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldDay setValue:disabledTextColor forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldDay setValue:disabledTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldDay setValue:disabledTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"min-size-datepicker-textfield"] forThemeAttribute:@"min-size"];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateNormal] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateSelected] forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateSelected] forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateNormal] forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:[_datePicker textColor] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateDisabled] forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldYear setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldYear setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
[_textFieldMonth setValue:textFieldMinSize forThemeAttribute:@"min-size"];
|
||||
[_textFieldMonth setValue:normalTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:selectedTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:selectedTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:selectedTextColor forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:selectedTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:selectedTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldMonth setValue:normalTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:normalTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:normalTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldMonth setValue:disabledTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMonth setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldMonth setValue:disabledTextColor forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMonth setValue:disabledTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMonth setValue:disabledTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"min-size-datepicker-textfield"] forThemeAttribute:@"min-size"];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateNormal] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateSelected] forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateSelected] forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateNormal] forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:[_datePicker textColor] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateDisabled] forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldHour setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldHour setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
[_textFieldYear setValue:textFieldMinSize forThemeAttribute:@"min-size"];
|
||||
[_textFieldYear setValue:normalTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:selectedTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:selectedTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:selectedTextColor forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:selectedTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:selectedTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldYear setValue:normalTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:normalTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:normalTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldYear setValue:disabledTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldYear setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldYear setValue:disabledTextColor forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldYear setValue:disabledTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldYear setValue:disabledTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"min-size-datepicker-textfield"] forThemeAttribute:@"min-size"];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateNormal] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateSelected] forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateSelected] forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateNormal] forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:[_datePicker textColor] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateDisabled] forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMinute setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMinute setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
[_textFieldHour setValue:textFieldMinSize forThemeAttribute:@"min-size"];
|
||||
[_textFieldHour setValue:normalTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:selectedTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:selectedTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:selectedTextColor forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:selectedTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:selectedTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldHour setValue:normalTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:normalTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:normalTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldHour setValue:disabledTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldHour setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldHour setValue:disabledTextColor forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldHour setValue:disabledTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldHour setValue:disabledTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"min-size-datepicker-textfield"] forThemeAttribute:@"min-size"];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateNormal] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateSelected] forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateSelected] forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateNormal] forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:[_datePicker textColor] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateDisabled] forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSecond setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSecond setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
[_textFieldMinute setValue:textFieldMinSize forThemeAttribute:@"min-size"];
|
||||
[_textFieldMinute setValue:normalTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:selectedTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:selectedTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:selectedTextColor forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:selectedTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:selectedTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldMinute setValue:normalTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:normalTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:normalTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldMinute setValue:disabledTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMinute setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldMinute setValue:disabledTextColor forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMinute setValue:disabledTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldMinute setValue:disabledTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"min-size-datepicker-textfield"] forThemeAttribute:@"min-size"];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateNormal] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield" inState:CPThemeStateSelected] forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateSelected] forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateNormal] forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:[_datePicker textColor] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"datepicker-textfield-bezel-color" inState:CPThemeStateDisabled] forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldPMAM setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldPMAM setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
[_textFieldSecond setValue:textFieldMinSize forThemeAttribute:@"min-size"];
|
||||
[_textFieldSecond setValue:normalTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:selectedTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:selectedTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:selectedTextColor forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:selectedTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:selectedTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldSecond setValue:normalTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:normalTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:normalTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldSecond setValue:disabledTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSecond setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldSecond setValue:disabledTextColor forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSecond setValue:disabledTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSecond setValue:disabledTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
|
||||
[_textFieldSeparatorOne setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield-separator" inState:CPThemeStateNormal] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorOne setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield-separator" inState:CPThemeStateSelected] forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldSeparatorOne setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorOne setValue:[_datePicker textColor] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorOne setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorOne setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorOne setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorOne setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorOne setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorOne setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
[_textFieldPMAM setValue:textFieldMinSize forThemeAttribute:@"min-size"];
|
||||
[_textFieldPMAM setValue:normalTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:selectedTextFieldContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:selectedTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:selectedTextColor forThemeAttribute:@"text-color" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:selectedTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:selectedTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateSelected];
|
||||
[_textFieldPMAM setValue:normalTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:normalTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:normalTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldPMAM setValue:disabledTextFieldBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldPMAM setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldPMAM setValue:disabledTextColor forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldPMAM setValue:disabledTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldPMAM setValue:disabledTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
|
||||
[_textFieldSeparatorTwo setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield-separator" inState:CPThemeStateNormal] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorTwo setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield-separator" inState:CPThemeStateSelected] forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldSeparatorTwo setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorTwo setValue:[_datePicker textColor] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorTwo setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorTwo setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorTwo setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorTwo setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorTwo setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorTwo setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorOne setValue:normalSeparatorContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorOne setValue:selectedSeparatorContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldSeparatorOne setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorOne setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorOne setValue:normalTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorOne setValue:normalTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorOne setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorOne setValue:disabledTextColor forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorOne setValue:disabledTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorOne setValue:disabledTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
|
||||
[_textFieldSeparatorThree setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield-separator" inState:CPThemeStateNormal] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorThree setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield-separator" inState:CPThemeStateSelected] forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldSeparatorThree setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorThree setValue:[_datePicker textColor] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorThree setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorThree setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorThree setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorThree setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorThree setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorThree setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorTwo setValue:normalSeparatorContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorTwo setValue:selectedSeparatorContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldSeparatorTwo setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorTwo setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorTwo setValue:normalTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorTwo setValue:normalTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorTwo setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorTwo setValue:disabledTextColor forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorTwo setValue:disabledTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorTwo setValue:disabledTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
|
||||
[_textFieldSeparatorFour setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield-separator" inState:CPThemeStateNormal] forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorFour setValue:[_datePicker valueForThemeAttribute:@"content-inset-datepicker-textfield-separator" inState:CPThemeStateSelected] forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldSeparatorFour setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorFour setValue:[_datePicker textColor] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorFour setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorFour setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorFour setValue:[_datePicker textFont] forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorFour setValue:[_datePicker valueForThemeAttribute:@"text-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorFour setValue:[_datePicker valueForThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorFour setValue:[_datePicker valueForThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled] forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorThree setValue:normalSeparatorContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorThree setValue:selectedSeparatorContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldSeparatorThree setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorThree setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorThree setValue:normalTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorThree setValue:normalTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorThree setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorThree setValue:disabledTextColor forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorThree setValue:disabledTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorThree setValue:disabledTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
|
||||
[_textFieldSeparatorFour setValue:normalSeparatorContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorFour setValue:selectedSeparatorContentInset forThemeAttribute:@"content-inset" inState:CPThemeStateSelected];
|
||||
[_textFieldSeparatorFour setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorFour setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorFour setValue:normalTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorFour setValue:normalTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateNormal];
|
||||
[_textFieldSeparatorFour setValue:textFont forThemeAttribute:@"font" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorFour setValue:disabledTextColor forThemeAttribute:@"text-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorFour setValue:disabledTextShadowColor forThemeAttribute:@"text-shadow-color" inState:CPThemeStateDisabled];
|
||||
[_textFieldSeparatorFour setValue:disabledTextShadowOffset forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateDisabled];
|
||||
}
|
||||
|
||||
/*! Hide or not the textField depending on the datePickerElements flag
|
||||
@@ -1013,7 +1136,7 @@ var CPZeroKeyCode = 48,
|
||||
if ([_textFieldMonth isHidden])
|
||||
[_textFieldHour setFrameOrigin:CGPointMake(horizontalInset, verticalInset)];
|
||||
else
|
||||
[_textFieldHour setFrameOrigin:CGPointMake(CGRectGetMaxX([_textFieldYear frame]) + [_datePicker valueForThemeAttribute:@"date-hour-margin"],verticalInset)];
|
||||
[_textFieldHour setFrameOrigin:CGPointMake(CGRectGetMaxX([_textFieldYear frame]) + [_datePicker currentValueForThemeAttribute:@"date-hour-margin"], verticalInset)];
|
||||
|
||||
[_textFieldSeparatorThree setFrameOrigin:CGPointMake(CGRectGetMaxX([_textFieldHour frame]) + separatorContentInset.left, verticalInset)];
|
||||
[_textFieldMinute setFrameOrigin:CGPointMake(CGRectGetMaxX([_textFieldSeparatorThree frame]) + separatorContentInset.right, verticalInset)];
|
||||
@@ -1043,6 +1166,25 @@ var CPZeroKeyCode = 48,
|
||||
[_textFieldPMAM sizeToFit];
|
||||
}
|
||||
|
||||
/*! Size to fit all of the textFields
|
||||
*/
|
||||
- (void)_setControlSizes
|
||||
{
|
||||
var controlSize = [_datePicker controlSize];
|
||||
|
||||
[_textFieldDay setControlSize:controlSize];
|
||||
[_textFieldMonth setControlSize:controlSize];
|
||||
[_textFieldYear setControlSize:controlSize];
|
||||
[_textFieldHour setControlSize:controlSize];
|
||||
[_textFieldMinute setControlSize:controlSize];
|
||||
[_textFieldSecond setControlSize:controlSize];
|
||||
[_textFieldSeparatorOne setControlSize:controlSize];
|
||||
[_textFieldSeparatorTwo setControlSize:controlSize];
|
||||
[_textFieldSeparatorThree setControlSize:controlSize];
|
||||
[_textFieldSeparatorFour setControlSize:controlSize];
|
||||
[_textFieldPMAM setControlSize:controlSize];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Responder methods
|
||||
@@ -1240,6 +1382,12 @@ var CPMonthDateType = 0,
|
||||
return self;
|
||||
}
|
||||
|
||||
/*! @ignore */
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return [_datePicker isEnabled];
|
||||
}
|
||||
|
||||
/*! Set the dateType of the textField
|
||||
*/
|
||||
- (void)setDateType:(int)aDateType
|
||||
@@ -1594,7 +1742,9 @@ var CPMonthDateType = 0,
|
||||
newDateValue.setSeconds(newDateValue.getSeconds() + secondsFromGMT - secondsFromGMTTimeZone);
|
||||
}
|
||||
|
||||
[_datePicker setDateValue:newDateValue];
|
||||
_datePicker._invokedByUserEvent = YES;
|
||||
[_datePicker _setDateValue:newDateValue timeInterval:[_datePicker timeInterval]];
|
||||
_datePicker._invokedByUserEvent = NO;
|
||||
}
|
||||
|
||||
|
||||
@@ -1692,4 +1842,9 @@ var CPMonthDateType = 0,
|
||||
return frameSize;
|
||||
}
|
||||
|
||||
@end
|
||||
- (CGRect)bezelRectForBounds:(CGRect)bounds
|
||||
{
|
||||
return CGRectMakeCopy(bounds);
|
||||
}
|
||||
|
||||
@end
|
||||
+4
-4
@@ -174,20 +174,20 @@ following:
|
||||
return _CPFontSystemFontSize;
|
||||
}
|
||||
|
||||
+ (float)systemFontSizeForControlSize:(CPControlSize)aSize
|
||||
+ (CPFont)systemFontForControlSize:(CPControlSize)aSize
|
||||
{
|
||||
// TODO These sizes should be themable or made less arbitrary in some other way.
|
||||
switch (aSize)
|
||||
{
|
||||
case CPSmallControlSize:
|
||||
return _CPFontSystemFontSize - 1;
|
||||
return [self systemFontOfSize:_CPFontSystemFontSize - 1];
|
||||
|
||||
case CPMiniControlSize:
|
||||
return _CPFontSystemFontSize - 2;
|
||||
return [self systemFontOfSize:_CPFontSystemFontSize - 2];
|
||||
|
||||
case CPRegularControlSize:
|
||||
default:
|
||||
return _CPFontSystemFontSize;
|
||||
return [self systemFontOfSize:_CPFontSystemFontSize];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +178,7 @@ var CPImageViewEmptyPlaceholderImage = nil;
|
||||
|
||||
- (void)imageDidLoad:(CPNotification)aNotification
|
||||
{
|
||||
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPImageDidLoadNotification object:[self objectValue]];
|
||||
[self hideOrDisplayContents];
|
||||
|
||||
[self setNeedsLayout];
|
||||
|
||||
@@ -70,6 +70,20 @@ var CPBindingOperationAnd = 0,
|
||||
return [[bindingsMap objectForKey:[anObject UID]] objectForKey:aBinding];
|
||||
}
|
||||
|
||||
+ (void)_reverseSetValueFromExclusiveBinderForObject:(id)anObject
|
||||
{
|
||||
var bindersByBindingName = [bindingsMap objectForKey:[anObject UID]];
|
||||
|
||||
[bindersByBindingName enumerateKeysAndObjectsUsingBlock:function(binding, binder, stop)
|
||||
{
|
||||
if ([binder isKindOfClass:[self class]])
|
||||
{
|
||||
[binder reverseSetValueFor:binding];
|
||||
stop(YES);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
+ (CPDictionary)infoForBinding:(CPString)aBinding forObject:(id)anObject
|
||||
{
|
||||
var theBinding = [self getBinding:aBinding forObject:anObject];
|
||||
@@ -116,7 +130,7 @@ var CPBindingOperationAnd = 0,
|
||||
count = allKeys.length;
|
||||
|
||||
while (count--)
|
||||
[anObject unbind:[bindings objectForKey:allKeys[count]]];
|
||||
[anObject unbind:allKeys[count]];
|
||||
|
||||
[bindingsMap removeObjectForKey:[anObject UID]];
|
||||
}
|
||||
@@ -142,7 +156,7 @@ var CPBindingOperationAnd = 0,
|
||||
|
||||
[self _updatePlaceholdersWithOptions:options forBinding:aName];
|
||||
|
||||
[aDestination addObserver:self forKeyPath:aKeyPath options:CPKeyValueObservingOptionNew context:aBinding];
|
||||
[aDestination addObserver:self forKeyPath:aKeyPath options:0 context:aBinding];
|
||||
|
||||
var bindings = [bindingsMap objectForKey:[_source UID]];
|
||||
|
||||
@@ -159,6 +173,24 @@ var CPBindingOperationAnd = 0,
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (BOOL)isBindingAllowed:(CPString)aBinding forObject:(id)anObject
|
||||
{
|
||||
if ([[anObject class] isBindingExclusive:aBinding])
|
||||
{
|
||||
var bindingsForObject = [bindingsMap objectForKey:[anObject UID]],
|
||||
allBindings = [bindingsForObject allKeys],
|
||||
count = [allBindings count];
|
||||
|
||||
while(count--)
|
||||
{
|
||||
if ([[anObject class] isBindingExclusive:allBindings[count]])
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)raiseIfNotApplicable:(id)aValue forKeyPath:(CPString)keyPath options:(CPDictionary)options
|
||||
{
|
||||
if (aValue === CPNotApplicableMarker && [options objectForKey:CPRaisesForNotApplicableKeysBindingOption])
|
||||
@@ -387,6 +419,11 @@ var CPBindingOperationAnd = 0,
|
||||
return [CPBinder class];
|
||||
}
|
||||
|
||||
+ (BOOL)isBindingExclusive:(CPString)aBinding
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (CPArray)exposedBindings
|
||||
{
|
||||
var exposedBindings = [],
|
||||
@@ -415,6 +452,11 @@ var CPBindingOperationAnd = 0,
|
||||
if (!anObject || !aKeyPath)
|
||||
return CPLog.error("Invalid object or path on " + self + " for " + aBinding);
|
||||
|
||||
if (![CPBinder isBindingAllowed:aBinding forObject:self])
|
||||
{
|
||||
CPLog.warn([self description] + " : cannot bind " + aBinding + " because another binding with the same functionality is already in use.");
|
||||
return;
|
||||
}
|
||||
//if (![[self exposedBindings] containsObject:aBinding])
|
||||
// CPLog.warn("No binding exposed on " + self + " for " + aBinding);
|
||||
|
||||
|
||||
@@ -410,7 +410,7 @@ _CPMenuWindowAttachedMenuBackgroundStyle = 2;
|
||||
{
|
||||
// Don't return indexes of items that aren't visible.
|
||||
if (!CGRectContainsPoint([_menuClipView bounds], [_menuClipView convertPoint:aPoint fromView:nil]))
|
||||
return NO;
|
||||
return CPNotFound;
|
||||
|
||||
return [_menuView itemIndexAtPoint:[_menuView convertPoint:aPoint fromView:nil]];
|
||||
}
|
||||
|
||||
+323
-215
@@ -186,6 +186,9 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
id _dropItem;
|
||||
|
||||
BOOL _coalesceSelectionNotificationState;
|
||||
|
||||
CPArray _pendingItemToClean;
|
||||
CPArray _itemAddedDuringLastLoading;
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
@@ -346,7 +349,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
if (!anItem)
|
||||
return YES;
|
||||
|
||||
var itemInfo = _itemInfosForItems[[anItem UID]];
|
||||
var itemInfo = [self _itemInfosForItem:anItem];
|
||||
|
||||
if (!itemInfo)
|
||||
return NO;
|
||||
@@ -379,7 +382,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
if (!anItem)
|
||||
return YES;
|
||||
|
||||
var itemInfo = _itemInfosForItems[[anItem UID]];
|
||||
var itemInfo = [self _itemInfosForItem:anItem];
|
||||
|
||||
if (!itemInfo)
|
||||
return NO;
|
||||
@@ -387,6 +390,107 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
return itemInfo.isExpanded;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the item at a given row index. If no item exists nil is returned.
|
||||
|
||||
@param aRow - The row index you want to find the item at.
|
||||
@return id - The item at a given index.
|
||||
*/
|
||||
- (id)itemAtRow:(CPInteger)aRow
|
||||
{
|
||||
return _itemsForRows[aRow] || nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the row of a given item
|
||||
|
||||
@param anItem - The item you want to find the row of.
|
||||
@return int - The row index of a given item.
|
||||
*/
|
||||
- (CPInteger)rowForItem:(id)anItem
|
||||
{
|
||||
if (!anItem)
|
||||
return _rootItemInfo.row;
|
||||
|
||||
var itemInfo = [self _itemInfosForItem:anItem];
|
||||
|
||||
if (!itemInfo)
|
||||
return CPNotFound;
|
||||
|
||||
return itemInfo.row;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the indentation level of a given item. If the item is nil (the top
|
||||
level root item) CPNotFound is returned. Indentation levels are zero
|
||||
based, thus items that are not indented return 0.
|
||||
|
||||
@param anItem - The item you want the indentation level for.
|
||||
@return int - the indentation level of anItem.
|
||||
*/
|
||||
- (CPInteger)levelForItem:(id)anItem
|
||||
{
|
||||
if (!anItem)
|
||||
return _rootItemInfo.level;
|
||||
|
||||
var itemInfo = [self _itemInfosForItem:anItem];
|
||||
|
||||
if (!itemInfo)
|
||||
return CPNotFound;
|
||||
|
||||
return itemInfo.level;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the indentation level for a given row. If the row is invalid
|
||||
CPNotFound is returned. Rows that are not indented return 0.
|
||||
|
||||
@param aRow - the row of the receiver
|
||||
@return int - the indentation level of aRow.
|
||||
*/
|
||||
- (CPInteger)levelForRow:(CPInteger)aRow
|
||||
{
|
||||
var item = [self itemAtRow:aRow];
|
||||
|
||||
if (!item && aRow >= 0)
|
||||
item = [CPObject new];
|
||||
|
||||
return [self levelForItem:item];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
Return the itemInfos for the given item.
|
||||
The method returns only itemInfo for displayed items
|
||||
*/
|
||||
- (Object)_itemInfosForItem:(id)anItem
|
||||
{
|
||||
var itemInfo = _itemInfosForItems[[anItem UID]];
|
||||
|
||||
if (!itemInfo || [self _parentIsCollapsed:[self parentForItem:anItem]])
|
||||
return nil;
|
||||
|
||||
return itemInfo;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
Return a boolean to know if one parent of the given item is collapsed or not
|
||||
*/
|
||||
- (BOOL)_parentIsCollapsed:(id)anItem
|
||||
{
|
||||
var parentItem = [self parentForItem:anItem],
|
||||
itemInfo = _itemInfosForItems[[anItem UID]];
|
||||
|
||||
if (!itemInfo)
|
||||
return NO;
|
||||
|
||||
if (!itemInfo.isExpanded)
|
||||
return YES;
|
||||
|
||||
return [self _parentIsCollapsed:parentItem];
|
||||
}
|
||||
|
||||
/*!
|
||||
Expands a given item.
|
||||
|
||||
@@ -423,6 +527,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
// selection notifications so that exactly one IsChanging and one
|
||||
// DidChange is sent as needed, for the totality of the operation.
|
||||
var isTopLevel = NO;
|
||||
|
||||
if (!_coalesceSelectionNotificationState)
|
||||
{
|
||||
isTopLevel = YES;
|
||||
@@ -442,6 +547,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
|
||||
// Shift selection indexes below so that the same items remain selected.
|
||||
var rowCountDelta = [self numberOfRows] - previousRowCount;
|
||||
|
||||
if (rowCountDelta)
|
||||
{
|
||||
var selection = [self selectedRowIndexes],
|
||||
@@ -531,6 +637,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
[self _setSelectedRowIndexes:selection]; // _noteSelectionDidChange will be suppressed.
|
||||
}
|
||||
}
|
||||
|
||||
itemInfo.isExpanded = NO;
|
||||
|
||||
[self reloadItem:anItem reloadChildren:YES];
|
||||
@@ -562,42 +669,205 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
*/
|
||||
- (void)reloadItem:(id)anItem reloadChildren:(BOOL)shouldReloadChildren
|
||||
{
|
||||
_pendingItemToClean = [];
|
||||
_itemAddedDuringLastLoading = [];
|
||||
|
||||
if (!!shouldReloadChildren || !anItem)
|
||||
_loadItemInfoForItem(self, anItem);
|
||||
[self _loadItemInfoForItem:anItem intermediate:NO];
|
||||
else
|
||||
_reloadItem(self, anItem);
|
||||
[self _reloadItem:anItem];
|
||||
|
||||
[self _cleanPendingItem];
|
||||
|
||||
[super reloadData];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the item at a given row index. If no item exists nil is returned.
|
||||
|
||||
@param aRow - The row index you want to find the item at.
|
||||
@return id - The item at a given index.
|
||||
*/
|
||||
- (id)itemAtRow:(CPInteger)aRow
|
||||
{
|
||||
return _itemsForRows[aRow] || nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the row of a given item
|
||||
|
||||
@param anItem - The item you want to find the row of.
|
||||
@return int - The row index of a given item.
|
||||
*/
|
||||
- (CPInteger)rowForItem:(id)anItem
|
||||
- (void)_reloadItem:(id)anItem
|
||||
{
|
||||
if (!anItem)
|
||||
return _rootItemInfo.row;
|
||||
return;
|
||||
|
||||
// Get the existing info if it exists.
|
||||
var itemUID = [anItem UID],
|
||||
itemInfo = _itemInfosForItems[itemUID];
|
||||
|
||||
// If we're not in the tree, then just bail.
|
||||
if (!itemInfo)
|
||||
return [];
|
||||
|
||||
// See if the item itself can be swapped out.
|
||||
var parent = itemInfo.parent,
|
||||
parentItemInfo = parent ? _itemInfosForItems[[parent UID]] : _rootItemInfo,
|
||||
parentChildren = parentItemInfo.children,
|
||||
index = [parentChildren indexOfObjectIdenticalTo:anItem],
|
||||
newItem = [_outlineViewDataSource outlineView:self child:index ofItem:parent];
|
||||
|
||||
if (anItem !== newItem)
|
||||
{
|
||||
_itemInfosForItems[[anItem UID]] = nil;
|
||||
_itemInfosForItems[[newItem UID]] = itemInfo;
|
||||
|
||||
parentChildren[index] = newItem;
|
||||
_itemsForRows[itemInfo.row] = newItem;
|
||||
}
|
||||
|
||||
itemInfo.isExpandable = [_outlineViewDataSource outlineView:self isItemExpandable:newItem];
|
||||
itemInfo.isExpanded = itemInfo.isExpandable && itemInfo.isExpanded;
|
||||
itemInfo.shouldShowOutlineDisclosureControl = [self _sendDelegateShouldShowOutlineDisclosureControlForItem:newItem];
|
||||
}
|
||||
|
||||
- (void)_addPendingItemsFromPreviousItems:(CPArray)previousItems forItemInfo:(Object)itemInfo
|
||||
{
|
||||
if (!itemInfo)
|
||||
return;
|
||||
|
||||
var children = itemInfo.children;
|
||||
|
||||
for (var i = [previousItems count] - 1; i >= 0; i--)
|
||||
{
|
||||
var item = previousItems[i];
|
||||
|
||||
if (![children containsObject:item])
|
||||
[self _addPendingItem:item];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_addPendingItem:(id)anItem
|
||||
{
|
||||
var itemInfo = _itemInfosForItems[[anItem UID]];
|
||||
|
||||
if (!itemInfo)
|
||||
return CPNotFound;
|
||||
return;
|
||||
|
||||
return itemInfo.row;
|
||||
var children = itemInfo.children;
|
||||
|
||||
for (var i = [children count]; i >= 0; i--)
|
||||
{
|
||||
var child = children[i];
|
||||
[self _addPendingItem:child];
|
||||
}
|
||||
|
||||
[_pendingItemToClean addObject:anItem];
|
||||
}
|
||||
|
||||
- (void)_cleanPendingItem
|
||||
{
|
||||
for (var i = [_pendingItemToClean count]; i >= 0; i--)
|
||||
{
|
||||
var item = _pendingItemToClean[i];
|
||||
|
||||
if (![_itemAddedDuringLastLoading containsObject:item])
|
||||
delete _itemInfosForItems[[item UID]];
|
||||
}
|
||||
|
||||
_pendingItemToClean = [];
|
||||
_itemAddedDuringLastLoading = [];
|
||||
}
|
||||
|
||||
- (CPArray)_loadItemInfoForItem:(id)anItem intermediate:(BOOL)isIntermediate
|
||||
{
|
||||
if (!anItem)
|
||||
{
|
||||
var itemInfo = _rootItemInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the existing info if it exists.
|
||||
var itemUID = [anItem UID],
|
||||
itemInfo = _itemInfosForItems[itemUID];
|
||||
|
||||
// If we're not in the tree, then just bail.
|
||||
if (!itemInfo)
|
||||
return [];
|
||||
|
||||
itemInfo.isExpandable = [_outlineViewDataSource outlineView:self isItemExpandable:anItem];
|
||||
itemInfo.shouldShowOutlineDisclosureControl = [self _sendDelegateShouldShowOutlineDisclosureControlForItem:anItem];
|
||||
|
||||
// If we were previously expanded, but now no longer expandable, "de-expand".
|
||||
// NOTE: we are *not* collapsing, thus no notification is posted.
|
||||
if (!itemInfo.isExpandable && itemInfo.isExpanded)
|
||||
{
|
||||
itemInfo.isExpanded = NO;
|
||||
itemInfo.children = [];
|
||||
}
|
||||
}
|
||||
|
||||
// The root item does not count as a descendant.
|
||||
var weight = itemInfo.weight,
|
||||
descendants = anItem ? [anItem] : [];
|
||||
|
||||
[_itemAddedDuringLastLoading addObject:anItem];
|
||||
|
||||
if (itemInfo.isExpanded && [self _sendDataSourceShouldDeferDisplayingChildrenOfItem:anItem])
|
||||
{
|
||||
var index = 0,
|
||||
count = [_outlineViewDataSource outlineView:self numberOfChildrenOfItem:anItem],
|
||||
level = itemInfo.level + 1,
|
||||
previousChildren = itemInfo.children;
|
||||
|
||||
itemInfo.children = [];
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var childItem = [_outlineViewDataSource outlineView:self child:index ofItem:anItem],
|
||||
childItemInfo = _itemInfosForItems[[childItem UID]];
|
||||
|
||||
if (!childItemInfo)
|
||||
{
|
||||
childItemInfo = { isExpanded:NO, isExpandable:NO, shouldShowOutlineDisclosureControl:YES, children:[], weight:1 };
|
||||
_itemInfosForItems[[childItem UID]] = childItemInfo;
|
||||
}
|
||||
|
||||
itemInfo.children[index] = childItem;
|
||||
|
||||
var childDescendants = [self _loadItemInfoForItem:childItem intermediate:YES];
|
||||
|
||||
childItemInfo.parent = anItem;
|
||||
childItemInfo.level = level;
|
||||
descendants = descendants.concat(childDescendants);
|
||||
}
|
||||
|
||||
// Here we clean the itemInfos dictionary
|
||||
// Some items could have been removed at this point, we don't need to keep a ref of them anymore
|
||||
[self _addPendingItemsFromPreviousItems:previousChildren forItemInfo:itemInfo];
|
||||
}
|
||||
|
||||
itemInfo.weight = descendants.length;
|
||||
|
||||
if (!isIntermediate)
|
||||
{
|
||||
// row = -1 is the root item, so just go to row 0 since it is ignored.
|
||||
var index = MAX(itemInfo.row, 0);
|
||||
|
||||
descendants.unshift(index, weight);
|
||||
|
||||
_itemsForRows.splice.apply(_itemsForRows, descendants);
|
||||
|
||||
var count = _itemsForRows.length;
|
||||
|
||||
for (; index < count; ++index)
|
||||
_itemInfosForItems[[_itemsForRows[index] UID]].row = index;
|
||||
|
||||
var deltaWeight = itemInfo.weight - weight;
|
||||
|
||||
if (deltaWeight !== 0)
|
||||
{
|
||||
var parent = itemInfo.parent;
|
||||
|
||||
while (parent)
|
||||
{
|
||||
var parentItemInfo = _itemInfosForItems[[parent UID]];
|
||||
|
||||
parentItemInfo.weight += deltaWeight;
|
||||
parent = parentItemInfo.parent;
|
||||
}
|
||||
|
||||
if (anItem)
|
||||
_rootItemInfo.weight += deltaWeight;
|
||||
}
|
||||
}
|
||||
|
||||
return descendants;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -627,39 +897,6 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
return _outlineTableColumn;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the indentation level of a given item. If the item is nil (the top
|
||||
level root item) CPNotFound is returned. Indentation levels are zero
|
||||
based, thus items that are not indented return 0.
|
||||
|
||||
@param anItem - The item you want the indentation level for.
|
||||
@return int - the indentation level of anItem.
|
||||
*/
|
||||
- (CPInteger)levelForItem:(id)anItem
|
||||
{
|
||||
if (!anItem)
|
||||
return _rootItemInfo.level;
|
||||
|
||||
var itemInfo = _itemInfosForItems[[anItem UID]];
|
||||
|
||||
if (!itemInfo)
|
||||
return CPNotFound;
|
||||
|
||||
return itemInfo.level;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the indentation level for a given row. If the row is invalid
|
||||
CPNotFound is returned. Rows that are not indented return 0.
|
||||
|
||||
@param aRow - the row of the receiver
|
||||
@return int - the indentation level of aRow.
|
||||
*/
|
||||
- (CPInteger)levelForRow:(CPInteger)aRow
|
||||
{
|
||||
return [self levelForItem:[self itemAtRow:aRow]];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the number of pixels to indent an item at each indentation level.
|
||||
|
||||
@@ -770,6 +1007,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
- (CGRect)frameOfOutlineDisclosureControlAtRow:(CPInteger)aRow
|
||||
{
|
||||
var theItem = [self itemAtRow:aRow];
|
||||
|
||||
if (![self isExpandable:theItem] || ![self _shouldShowOutlineDisclosureControlForItem:theItem])
|
||||
return CGRectMakeZero();
|
||||
|
||||
@@ -1042,17 +1280,6 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
CPLog.warn("outlineView:dataViewForTableColumn:item: is deprecated. You should use -outlineView:viewForTableColumn:item: where you can request the view with -makeViewWithIdentifier:owner:");
|
||||
}
|
||||
|
||||
- (BOOL)_sendDelegateDeleteKeyPressed
|
||||
{
|
||||
if ([[self delegate] respondsToSelector: @selector(outlineViewDeleteKeyPressed:)])
|
||||
{
|
||||
[[self delegate] outlineViewDeleteKeyPressed:self];
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the delegate object for the outlineview.
|
||||
*/
|
||||
@@ -1611,6 +1838,33 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
[super keyDown:anEvent];
|
||||
}
|
||||
|
||||
- (BOOL)_sendDelegateDeleteKeyPressed
|
||||
{
|
||||
if ([[self delegate] respondsToSelector: @selector(outlineViewDeleteKeyPressed:)])
|
||||
{
|
||||
[[self delegate] outlineViewDeleteKeyPressed:self];
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)_sendDelegateShouldShowOutlineDisclosureControlForItem:(id)anItem
|
||||
{
|
||||
if (!(_implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_shouldShowOutlineDisclosureControlForItem_))
|
||||
return YES;
|
||||
|
||||
return [_outlineViewDelegate outlineView:self shouldShowOutlineDisclosureControlForItem:anItem];
|
||||
}
|
||||
|
||||
- (BOOL)_sendDataSourceShouldDeferDisplayingChildrenOfItem:(id)anItem
|
||||
{
|
||||
if (!(_implementedOutlineViewDataSourceMethods & CPOutlineViewDataSource_outlineView_shouldDeferDisplayingChildrenOfItem_))
|
||||
return YES;
|
||||
|
||||
return [_outlineViewDataSource outlineView:self shouldDeferDisplayingChildrenOfItem:anItem];
|
||||
}
|
||||
|
||||
- (CPView)_sendDelegateViewForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow
|
||||
{
|
||||
return [_outlineViewDelegate outlineView:self viewForTableColumn:aTableColumn item:[self itemAtRow:aRow]];
|
||||
@@ -1666,152 +1920,6 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
||||
|
||||
@end
|
||||
|
||||
// FIX ME: We're using with() here because Safari fails if we use anOutlineView._itemInfosForItems or whatever...
|
||||
var _reloadItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anItem)
|
||||
{
|
||||
if (!anItem)
|
||||
return;
|
||||
|
||||
with (anOutlineView)
|
||||
{
|
||||
// Get the existing info if it exists.
|
||||
var itemInfosForItems = _itemInfosForItems,
|
||||
dataSource = _outlineViewDataSource,
|
||||
itemUID = [anItem UID],
|
||||
itemInfo = itemInfosForItems[itemUID];
|
||||
|
||||
// If we're not in the tree, then just bail.
|
||||
if (!itemInfo)
|
||||
return [];
|
||||
|
||||
// See if the item itself can be swapped out.
|
||||
var parent = itemInfo.parent,
|
||||
parentItemInfo = parent ? itemInfosForItems[[parent UID]] : _rootItemInfo,
|
||||
parentChildren = parentItemInfo.children,
|
||||
index = [parentChildren indexOfObjectIdenticalTo:anItem],
|
||||
newItem = [dataSource outlineView:anOutlineView child:index ofItem:parent];
|
||||
|
||||
if (anItem !== newItem)
|
||||
{
|
||||
itemInfosForItems[[anItem UID]] = nil;
|
||||
itemInfosForItems[[newItem UID]] = itemInfo;
|
||||
|
||||
parentChildren[index] = newItem;
|
||||
_itemsForRows[itemInfo.row] = newItem;
|
||||
}
|
||||
|
||||
itemInfo.isExpandable = [dataSource outlineView:anOutlineView isItemExpandable:newItem];
|
||||
itemInfo.isExpanded = itemInfo.isExpandable && itemInfo.isExpanded;
|
||||
itemInfo.shouldShowOutlineDisclosureControl = !(_implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_shouldShowOutlineDisclosureControlForItem_) || [_outlineViewDelegate outlineView:self shouldShowOutlineDisclosureControlForItem:newItem];
|
||||
}
|
||||
};
|
||||
|
||||
// FIX ME: We're using with() here because Safari fails if we use anOutlineView._itemInfosForItems or whatever...
|
||||
var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anItem, /*BOOL*/ isIntermediate)
|
||||
{
|
||||
with (anOutlineView)
|
||||
{
|
||||
var itemInfosForItems = _itemInfosForItems,
|
||||
dataSource = _outlineViewDataSource;
|
||||
|
||||
if (!anItem)
|
||||
var itemInfo = _rootItemInfo;
|
||||
|
||||
else
|
||||
{
|
||||
// Get the existing info if it exists.
|
||||
var itemUID = [anItem UID],
|
||||
itemInfo = itemInfosForItems[itemUID];
|
||||
|
||||
// If we're not in the tree, then just bail.
|
||||
if (!itemInfo)
|
||||
return [];
|
||||
|
||||
itemInfo.isExpandable = [dataSource outlineView:anOutlineView isItemExpandable:anItem];
|
||||
itemInfo.shouldShowOutlineDisclosureControl = !(_implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_shouldShowOutlineDisclosureControlForItem_) || [_outlineViewDelegate outlineView:self shouldShowOutlineDisclosureControlForItem:anItem];
|
||||
|
||||
// If we were previously expanded, but now no longer expandable, "de-expand".
|
||||
// NOTE: we are *not* collapsing, thus no notification is posted.
|
||||
if (!itemInfo.isExpandable && itemInfo.isExpanded)
|
||||
{
|
||||
itemInfo.isExpanded = NO;
|
||||
itemInfo.children = [];
|
||||
}
|
||||
}
|
||||
|
||||
// The root item does not count as a descendant.
|
||||
var weight = itemInfo.weight,
|
||||
descendants = anItem ? [anItem] : [];
|
||||
|
||||
if (itemInfo.isExpanded && (!(_implementedOutlineViewDataSourceMethods & CPOutlineViewDataSource_outlineView_shouldDeferDisplayingChildrenOfItem_) ||
|
||||
![dataSource outlineView:anOutlineView shouldDeferDisplayingChildrenOfItem:anItem]))
|
||||
{
|
||||
var index = 0,
|
||||
count = [dataSource outlineView:anOutlineView numberOfChildrenOfItem:anItem],
|
||||
level = itemInfo.level + 1;
|
||||
|
||||
itemInfo.children = [];
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var childItem = [dataSource outlineView:anOutlineView child:index ofItem:anItem],
|
||||
childItemInfo = itemInfosForItems[[childItem UID]];
|
||||
|
||||
if (!childItemInfo)
|
||||
{
|
||||
childItemInfo = { isExpanded:NO, isExpandable:NO, shouldShowOutlineDisclosureControl:YES, children:[], weight:1 };
|
||||
itemInfosForItems[[childItem UID]] = childItemInfo;
|
||||
}
|
||||
|
||||
itemInfo.children[index] = childItem;
|
||||
|
||||
var childDescendants = _loadItemInfoForItem(anOutlineView, childItem, YES);
|
||||
|
||||
childItemInfo.parent = anItem;
|
||||
childItemInfo.level = level;
|
||||
descendants = descendants.concat(childDescendants);
|
||||
}
|
||||
}
|
||||
|
||||
itemInfo.weight = descendants.length;
|
||||
|
||||
if (!isIntermediate)
|
||||
{
|
||||
// row = -1 is the root item, so just go to row 0 since it is ignored.
|
||||
var index = MAX(itemInfo.row, 0),
|
||||
itemsForRows = _itemsForRows;
|
||||
|
||||
descendants.unshift(index, weight);
|
||||
|
||||
itemsForRows.splice.apply(itemsForRows, descendants);
|
||||
|
||||
var count = itemsForRows.length;
|
||||
|
||||
for (; index < count; ++index)
|
||||
itemInfosForItems[[itemsForRows[index] UID]].row = index;
|
||||
|
||||
var deltaWeight = itemInfo.weight - weight;
|
||||
|
||||
if (deltaWeight !== 0)
|
||||
{
|
||||
var parent = itemInfo.parent;
|
||||
|
||||
while (parent)
|
||||
{
|
||||
var parentItemInfo = itemInfosForItems[[parent UID]];
|
||||
|
||||
parentItemInfo.weight += deltaWeight;
|
||||
parent = parentItemInfo.parent;
|
||||
}
|
||||
|
||||
if (anItem)
|
||||
_rootItemInfo.weight += deltaWeight;
|
||||
}
|
||||
}
|
||||
}//end of with
|
||||
return descendants;
|
||||
};
|
||||
|
||||
@implementation _CPOutlineViewTableViewDataSource : CPObject
|
||||
{
|
||||
CPObject _outlineView;
|
||||
|
||||
+14
-31
@@ -26,8 +26,6 @@
|
||||
@import "CPMenu.j"
|
||||
@import "CPMenuItem.j"
|
||||
|
||||
var VISIBLE_MARGIN = 7.0;
|
||||
|
||||
CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
/*!
|
||||
@@ -773,13 +771,6 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
[[self selectedItem] setState:CPOffState];
|
||||
}
|
||||
|
||||
- (void)_reverseSetBinding
|
||||
{
|
||||
[_CPPopUpButtonSelectionBinder reverseSetValueForObject:self];
|
||||
|
||||
[super _reverseSetBinding];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPPopUpButton (BindingSupport)
|
||||
@@ -802,6 +793,20 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
return [super _binderClassForBinding:aBinding];
|
||||
}
|
||||
|
||||
+ (BOOL)isBindingExclusive:(CPString)aBinding
|
||||
{
|
||||
return (aBinding == CPSelectedIndexBinding ||
|
||||
aBinding == CPSelectedTagBinding ||
|
||||
aBinding == CPSelectedValueBinding);
|
||||
}
|
||||
|
||||
- (void)_reverseSetBinding
|
||||
{
|
||||
[_CPPopUpButtonSelectionBinder _reverseSetValueFromExclusiveBinderForObject:self];
|
||||
|
||||
[super _reverseSetBinding];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPPopUpButtonContentBinder : CPBinder
|
||||
@@ -931,30 +936,8 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
@end
|
||||
|
||||
var binderForObject = {};
|
||||
|
||||
@implementation _CPPopUpButtonSelectionBinder : CPBinder
|
||||
{
|
||||
CPString _selectionBinding @accessors;
|
||||
}
|
||||
|
||||
- (id)initWithBinding:(CPString)aBinding name:(CPString)aName to:(id)aDestination keyPath:(CPString)aKeyPath options:(CPDictionary)options from:(id)aSource
|
||||
{
|
||||
self = [super initWithBinding:aBinding name:aName to:aDestination keyPath:aKeyPath options:options from:aSource];
|
||||
|
||||
if (self)
|
||||
{
|
||||
binderForObject[[aSource UID]] = self;
|
||||
_selectionBinding = aName;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (void)reverseSetValueForObject:(id)aSource
|
||||
{
|
||||
var binder = binderForObject[[aSource UID]];
|
||||
[binder reverseSetValueFor:[binder _selectionBinding]];
|
||||
}
|
||||
|
||||
- (void)setPlaceholderValue:(id)aValue withMarker:(CPString)aMarker forBinding:(CPString)aBinding
|
||||
|
||||
+13
-7
@@ -246,9 +246,7 @@ Set the behavior of the CPPopover. It can be:
|
||||
if (!_popoverWindow)
|
||||
_popoverWindow = [[_CPPopoverWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:[self _styleMaskForBehavior]];
|
||||
|
||||
if (_positioningView != positioningView)
|
||||
[_popoverWindow setPlatformWindow:[[positioningView window] platformWindow]];
|
||||
|
||||
[_popoverWindow setPlatformWindow:[[positioningView window] platformWindow]];
|
||||
[_popoverWindow setAppearance:_appearance];
|
||||
[_popoverWindow setAnimates:_animates];
|
||||
[_popoverWindow setDelegate:self];
|
||||
@@ -262,7 +260,7 @@ Set the behavior of the CPPopover. It can be:
|
||||
[_popoverWindow positionRelativeToRect:positioningRect ofView:positioningView preferredEdge:preferredEdge];
|
||||
|
||||
if (![self isShown])
|
||||
[self _popoverDidShow];
|
||||
[self _popoverWindowDidShow];
|
||||
}
|
||||
|
||||
- (unsigned)_styleMaskForBehavior
|
||||
@@ -312,9 +310,8 @@ Set the behavior of the CPPopover. It can be:
|
||||
if ([_popoverWindow isClosing])
|
||||
return;
|
||||
|
||||
if (_implementedDelegateMethods & CPPopoverDelegate_popover_shouldClose_)
|
||||
if (![_delegate popoverShouldClose:self])
|
||||
return;
|
||||
if (![self _popoverShouldClose])
|
||||
return;
|
||||
|
||||
[self _close];
|
||||
}
|
||||
@@ -348,6 +345,15 @@ Set the behavior of the CPPopover. It can be:
|
||||
[_delegate popoverDidShow:self];
|
||||
}
|
||||
|
||||
/*! @ignore */
|
||||
- (BOOL)_popoverShouldClose
|
||||
{
|
||||
if (_implementedDelegateMethods & CPPopoverDelegate_popover_shouldClose_)
|
||||
return [_delegate popoverShouldClose:self];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
/*! @ignore */
|
||||
- (void)_popoverWillClose
|
||||
{
|
||||
|
||||
+8
-23
@@ -356,7 +356,7 @@ var CPRadioRadioGroupKey = @"CPRadioRadioGroupKey";
|
||||
[_selectedRadio setState:CPOffState];
|
||||
|
||||
_selectedRadio = aRadio;
|
||||
[_CPRadioGroupSelectionBinder reverseSetValueForObject:self];
|
||||
[_CPRadioGroupSelectionBinder _reverseSetValueFromExclusiveBinderForObject:self];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -407,32 +407,17 @@ var CPRadioGroupRadiosKey = @"CPRadioGroupRadiosKey",
|
||||
return [super _binderClassForBinding:aBinding];
|
||||
}
|
||||
|
||||
@end
|
||||
+ (BOOL)isBindingExclusive:(CPString)aBinding
|
||||
{
|
||||
return (aBinding == CPSelectedIndexBinding ||
|
||||
aBinding == CPSelectedTagBinding ||
|
||||
aBinding == CPSelectedValueBinding);
|
||||
}
|
||||
|
||||
var binderForObject = {};
|
||||
@end
|
||||
|
||||
@implementation _CPRadioGroupSelectionBinder : CPBinder
|
||||
{
|
||||
CPString _selectionBinding @accessors;
|
||||
}
|
||||
|
||||
- (id)initWithBinding:(CPString)aBinding name:(CPString)aName to:(id)aDestination keyPath:(CPString)aKeyPath options:(CPDictionary)options from:(id)aSource
|
||||
{
|
||||
self = [super initWithBinding:aBinding name:aName to:aDestination keyPath:aKeyPath options:options from:aSource];
|
||||
|
||||
if (self)
|
||||
{
|
||||
binderForObject[[aSource UID]] = self;
|
||||
_selectionBinding = aName;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (void)reverseSetValueForObject:(id)aSource
|
||||
{
|
||||
var binder = binderForObject[[aSource UID]];
|
||||
[binder reverseSetValueFor:[binder _selectionBinding]];
|
||||
}
|
||||
|
||||
- (void)setPlaceholderValue:(id)aValue withMarker:(CPString)aMarker forBinding:(CPString)aBinding
|
||||
|
||||
@@ -708,7 +708,10 @@ CPTransformableAttributeType = 1800;
|
||||
view = [[CPCheckBox alloc] initWithFrame:CGRectMake(0, 0, 50, 26)];
|
||||
}
|
||||
else if (attributeType == CPDateAttributeType)
|
||||
{
|
||||
view = [[CPDatePicker alloc] initWithFrame:CGRectMake(0, 0, 180, 26)];
|
||||
[view setDatePickerElements:CPYearMonthDayDatePickerElementFlag];
|
||||
}
|
||||
else
|
||||
return nil;
|
||||
|
||||
|
||||
@@ -147,8 +147,10 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
||||
@"slice-bottom-border-color": [CPNull null],
|
||||
@"slice-last-bottom-border-color": [CPNull null],
|
||||
@"font": [CPNull null],
|
||||
@"font-color": [CPNull null],
|
||||
@"add-image": [CPNull null],
|
||||
@"remove-image": [CPNull null],
|
||||
@"vertical-alignment": [CPNull null]
|
||||
};
|
||||
}
|
||||
|
||||
@@ -159,7 +161,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
||||
{
|
||||
_slices = [[CPMutableArray alloc] init];
|
||||
|
||||
_sliceHeight = 26.;
|
||||
_sliceHeight = 26.0;
|
||||
_nestingMode = CPRuleEditorNestingModeSimple; // 10.5 default is CPRuleEditorNestingModeCompound
|
||||
_editable = YES;
|
||||
_allowsEmptyCompoundRows = NO;
|
||||
@@ -1885,14 +1887,34 @@ TODO: implement
|
||||
return [self valueForThemeAttribute:@"font"];
|
||||
}
|
||||
|
||||
- (CPImage)_addImage
|
||||
- (CPColor)_fontColor
|
||||
{
|
||||
return [self valueForThemeAttribute:@"add-image"];
|
||||
return [self valueForThemeAttribute:@"font-color"];
|
||||
}
|
||||
|
||||
- (CPImage)_removeImage
|
||||
- (CPImage)_imageAdd
|
||||
{
|
||||
return [self valueForThemeAttribute:@"remove-image"];
|
||||
return [self valueForThemeAttribute:@"add-image" inState:CPThemeStateNormal];
|
||||
}
|
||||
|
||||
- (CPImage)_imageAddHighlighted
|
||||
{
|
||||
return [self valueForThemeAttribute:@"add-image" inState:CPThemeStateHighlighted];
|
||||
}
|
||||
|
||||
- (CPImage)_imageRemove
|
||||
{
|
||||
return [self valueForThemeAttribute:@"remove-image" inState:CPThemeStateNormal];
|
||||
}
|
||||
|
||||
- (CPImage)_imageRemoveHighlighted
|
||||
{
|
||||
return [self valueForThemeAttribute:@"remove-image" inState:CPThemeStateHighlighted];
|
||||
}
|
||||
|
||||
- (CPVerticalTextAlignment)_verticalAlignment
|
||||
{
|
||||
return [self valueForThemeAttribute:@"vertical-alignment"];
|
||||
}
|
||||
|
||||
- (CPString)_toolTipForAddCompoundRowButton
|
||||
|
||||
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
* Created by cacaodev@gmail.com.
|
||||
* Copyright (c) 2011 Pear, Inc. All rights reserved.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
@import "CPBezierPath.j"
|
||||
@import "CPPopUpButton.j"
|
||||
|
||||
@class _CPRuleEditorViewSlice
|
||||
|
||||
var GRADIENT_START_COLOR = "#fcfcfc",
|
||||
GRADIENT_END_COLOR = "#dfdfdf",
|
||||
BORDER_COLOR = "#BDBDBD";
|
||||
|
||||
var GRADIENT_NORMAL,
|
||||
GRADIENT_HIGHLIGHTED,
|
||||
GRADIENT_PROPERTY;
|
||||
|
||||
if (CPBrowserIsEngine(CPWebKitBrowserEngine))
|
||||
{
|
||||
GRADIENT_NORMAL = "-webkit-gradient(linear, left top, left bottom, from(" + GRADIENT_START_COLOR + "), to(" + GRADIENT_END_COLOR + "))",
|
||||
GRADIENT_HIGHLIGHTED = "-webkit-gradient(linear, left top, left bottom, from(" + GRADIENT_END_COLOR + "), to(" + GRADIENT_START_COLOR + "))";
|
||||
GRADIENT_PROPERTY = "background";
|
||||
}
|
||||
else if (CPBrowserIsEngine(CPGeckoBrowserEngine))
|
||||
{
|
||||
GRADIENT_NORMAL = "-moz-linear-gradient(top, " + GRADIENT_START_COLOR + ", " + GRADIENT_END_COLOR + ")",
|
||||
GRADIENT_HIGHLIGHTED = "-moz-linear-gradient(top, " + GRADIENT_END_COLOR + ", " + GRADIENT_START_COLOR + ")";
|
||||
GRADIENT_PROPERTY = "background";
|
||||
}
|
||||
else if (CPBrowserIsEngine(CPInternetExplorerBrowserEngine))
|
||||
{
|
||||
GRADIENT_NORMAL = "progid:DXImageTransform.Microsoft.gradient(startColorstr='" + GRADIENT_START_COLOR + "', endColorstr='" + GRADIENT_END_COLOR + "')";
|
||||
GRADIENT_HIGHLIGHTED = "progid:DXImageTransform.Microsoft.gradient(startColorstr='" + GRADIENT_END_COLOR + "', endColorstr='" + GRADIENT_START_COLOR + "')";
|
||||
GRADIENT_PROPERTY = "filter";
|
||||
}else
|
||||
{
|
||||
GRADIENT_NORMAL = GRADIENT_START_COLOR;
|
||||
GRADIENT_HIGHLIGHTED = GRADIENT_END_COLOR;
|
||||
GRADIENT_PROPERTY = "background";
|
||||
}
|
||||
|
||||
@implementation _CPRuleEditorPopUpButton : CPPopUpButton
|
||||
{
|
||||
CPInteger radius;
|
||||
}
|
||||
|
||||
- (void)_sharedInit
|
||||
{
|
||||
[self setBordered:NO];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
var style = _DOMElement.style;
|
||||
style.border = "1px solid " + BORDER_COLOR;
|
||||
style[GRADIENT_PROPERTY] = GRADIENT_NORMAL;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
if (self = [super initWithFrame:aFrame])
|
||||
[self _sharedInit];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
[self _sharedInit];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CPView)hitTest:(CGPoint)point
|
||||
{
|
||||
if (!CGRectContainsPoint([self frame], point) || ![self sliceIsEditable])
|
||||
return nil;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)sliceIsEditable
|
||||
{
|
||||
var superview = [self superview];
|
||||
return ![superview isKindOfClass:[_CPRuleEditorViewSlice]] || [superview isEditable];
|
||||
}
|
||||
|
||||
- (void)trackMouse:(CPEvent)theEvent
|
||||
{
|
||||
if (![self sliceIsEditable])
|
||||
return;
|
||||
|
||||
[super trackMouse:theEvent];
|
||||
}
|
||||
|
||||
- (CGRect)contentRectForBounds:(CGRect)bounds
|
||||
{
|
||||
var contentRect = [super contentRectForBounds:bounds];
|
||||
contentRect.origin.x += radius;
|
||||
contentRect.size.width -= 2 * radius;
|
||||
|
||||
return contentRect;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
radius = FLOOR(CGRectGetHeight([self bounds]) / 2);
|
||||
var style = _DOMElement.style,
|
||||
radiusCSS = radius + "px";
|
||||
|
||||
style.borderRadius = radiusCSS;
|
||||
#endif
|
||||
|
||||
[super layoutSubviews];
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)aRect
|
||||
{
|
||||
var context = [[CPGraphicsContext currentContext] graphicsPort],
|
||||
bounds = [self bounds],
|
||||
arrow_width = FLOOR(CGRectGetHeight(bounds) / 3.5);
|
||||
|
||||
CGContextTranslateCTM(context, CGRectGetWidth(bounds) - radius - arrow_width, CGRectGetHeight(bounds) / 2);
|
||||
|
||||
var arrowsPath = [CPBezierPath bezierPath];
|
||||
[arrowsPath moveToPoint:CGPointMake(0, 1)];
|
||||
[arrowsPath lineToPoint:CGPointMake(arrow_width, 1)];
|
||||
[arrowsPath lineToPoint:CGPointMake(arrow_width / 2, arrow_width + 1)];
|
||||
[arrowsPath closePath];
|
||||
|
||||
CGContextSetFillColor(context, [CPColor colorWithWhite:101 / 255 alpha:1]);
|
||||
[arrowsPath fill];
|
||||
|
||||
CGContextScaleCTM(context, 1 , -1);
|
||||
[arrowsPath fill];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPRuleEditorButton : CPButton
|
||||
{
|
||||
CPInteger radius;
|
||||
}
|
||||
|
||||
- (void)_sharedInit
|
||||
{
|
||||
[self setBordered:NO];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
var style = _DOMElement.style;
|
||||
style.border = "1px solid " + BORDER_COLOR;
|
||||
style[GRADIENT_PROPERTY] = GRADIENT_NORMAL;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
if (self = [super initWithFrame:aFrame])
|
||||
[self _sharedInit];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
[self _sharedInit];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
radius = FLOOR(CGRectGetHeight([self bounds]) / 2);
|
||||
|
||||
var style = _DOMElement.style,
|
||||
radiusCSS = radius + "px";
|
||||
|
||||
style.borderRadius = radiusCSS;
|
||||
style[GRADIENT_PROPERTY] = ([self isHighlighted]) ? GRADIENT_HIGHLIGHTED : GRADIENT_NORMAL;
|
||||
#endif
|
||||
|
||||
[super layoutSubviews];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -61,9 +61,9 @@
|
||||
- (void)drawRect:(CGRect)rect
|
||||
{
|
||||
var context = [[CPGraphicsContext currentContext] graphicsPort],
|
||||
bounds = [self bounds],
|
||||
maxX = CGRectGetWidth(bounds),
|
||||
maxY = CGRectGetHeight(bounds);
|
||||
bounds = [self bounds],
|
||||
maxX = CGRectGetWidth(bounds),
|
||||
maxY = CGRectGetHeight(bounds);
|
||||
|
||||
// Draw background
|
||||
if ([self _isSelected])
|
||||
|
||||
@@ -19,24 +19,27 @@
|
||||
|
||||
@import "CPRuleEditor_Constants.j"
|
||||
@import "_CPRuleEditorViewSlice.j"
|
||||
@import "_CPRuleEditorPopUpButton.j"
|
||||
|
||||
@import "CPButton.j"
|
||||
@import "CPDatePicker.j"
|
||||
@import "CPPopUpButton.j"
|
||||
|
||||
@global CPApp
|
||||
|
||||
var CONTROL_HEIGHT = 16.,
|
||||
BUTTON_HEIGHT = 16.;
|
||||
@global CPMiniControlSize
|
||||
@global CPSmallControlSize
|
||||
|
||||
@implementation _CPRuleEditorViewSliceRow : _CPRuleEditorViewSlice
|
||||
{
|
||||
CPMutableArray _ruleOptionViews;
|
||||
CPMutableArray _ruleOptionFrames;
|
||||
CPMutableArray _correspondingRuleItems;
|
||||
CPMutableArray _ruleOptionInitialViewFrames;
|
||||
CPButton _addButton;
|
||||
CPButton _subtractButton;
|
||||
CPButton _addButton;
|
||||
CPButton _subtractButton;
|
||||
CPMutableArray _correspondingRuleItems;
|
||||
CPMutableArray _ruleOptionFrames;
|
||||
CPMutableArray _ruleOptionInitialViewFrames;
|
||||
CPMutableArray _ruleOptionViews;
|
||||
|
||||
CPRuleEditorRowType _rowType @accessors;
|
||||
CPRuleEditorRowType _plusButtonRowType;
|
||||
|
||||
CPRuleEditorRowType _rowType @accessors;
|
||||
CPRuleEditorRowType _plusButtonRowType;
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame ruleEditorView:(id)editor
|
||||
@@ -49,34 +52,33 @@ var CONTROL_HEIGHT = 16.,
|
||||
|
||||
- (void)_initShared
|
||||
{
|
||||
_correspondingRuleItems = [[CPMutableArray alloc] init];
|
||||
_ruleOptionFrames = [[CPMutableArray alloc] init];
|
||||
_ruleOptionInitialViewFrames = [[CPMutableArray alloc] init];
|
||||
_ruleOptionViews = [[CPMutableArray alloc] init];
|
||||
_editable = [_ruleEditor isEditable];
|
||||
_correspondingRuleItems = [[CPMutableArray alloc] init];
|
||||
_ruleOptionFrames = [[CPMutableArray alloc] init];
|
||||
_ruleOptionInitialViewFrames = [[CPMutableArray alloc] init];
|
||||
_ruleOptionViews = [[CPMutableArray alloc] init];
|
||||
_editable = [_ruleEditor isEditable];
|
||||
|
||||
_addButton = [self _createAddRowButton];
|
||||
_subtractButton = [self _createDeleteRowButton];
|
||||
|
||||
_addButton = [self _createAddRowButton];
|
||||
_subtractButton = [self _createDeleteRowButton];
|
||||
[_addButton setToolTip:[_ruleEditor _toolTipForAddSimpleRowButton]];
|
||||
[_subtractButton setToolTip:[_ruleEditor _toolTipForDeleteRowButton]];
|
||||
[_addButton setHidden:!_editable];
|
||||
[_subtractButton setHidden:!_editable];
|
||||
[self addSubview:_addButton];
|
||||
[self addSubview:_subtractButton];
|
||||
|
||||
[self setAutoresizingMask:CPViewWidthSizable];
|
||||
|
||||
var center = [CPNotificationCenter defaultCenter];
|
||||
[center addObserver:self selector:@selector(_textDidChange:) name:CPControlTextDidChangeNotification object:nil];
|
||||
}
|
||||
|
||||
- (CPButton)_createRowButton
|
||||
{
|
||||
var button = [[_CPRuleEditorButton alloc] initWithFrame:CGRectMakeZero()];
|
||||
[button setFont:[CPFont boldFontWithName:@"Apple Symbol" size:12.0]];
|
||||
[button setTextColor:[CPColor colorWithWhite:150 / 255 alpha:1]];
|
||||
var button = [[CPButton alloc] initWithFrame:CGRectMakeZero()];
|
||||
|
||||
[button setFont:[_ruleEditor font]];
|
||||
[button setTextColor:[_ruleEditor _fontColor]];
|
||||
|
||||
[button setAlignment:CPCenterTextAlignment];
|
||||
[button setAutoresizingMask:CPViewMinXMargin];
|
||||
[button setButtonType:CPMomentaryChangeButton];
|
||||
[button setBordered:NO];
|
||||
[button setHidden:!_editable];
|
||||
[button setImagePosition:CPImageOnly];
|
||||
|
||||
return button;
|
||||
@@ -86,7 +88,10 @@ var CONTROL_HEIGHT = 16.,
|
||||
{
|
||||
var button = [self _createRowButton];
|
||||
|
||||
[button setImage:[_ruleEditor _addImage]];
|
||||
[button setToolTip:[_ruleEditor _toolTipForAddSimpleRowButton]];
|
||||
[button setValue:[_ruleEditor _imageAdd] forThemeAttribute:@"image" inState:CPThemeStateNormal];
|
||||
[button setValue:[_ruleEditor _imageAddHighlighted] forThemeAttribute:@"image" inState:CPThemeStateHighlighted];
|
||||
|
||||
[button setAction:@selector(_addOption:)];
|
||||
[button setTarget:self];
|
||||
|
||||
@@ -97,7 +102,10 @@ var CONTROL_HEIGHT = 16.,
|
||||
{
|
||||
var button = [self _createRowButton];
|
||||
|
||||
[button setImage:[_ruleEditor _removeImage]];
|
||||
[button setToolTip:[_ruleEditor _toolTipForDeleteRowButton]];
|
||||
[button setValue:[_ruleEditor _imageRemove] forThemeAttribute:@"image" inState:CPThemeStateNormal];
|
||||
[button setValue:[_ruleEditor _imageRemoveHighlighted] forThemeAttribute:@"image" inState:CPThemeStateHighlighted];
|
||||
|
||||
[button setAction:@selector(_deleteOption:)];
|
||||
[button setTarget:self];
|
||||
|
||||
@@ -107,20 +115,17 @@ var CONTROL_HEIGHT = 16.,
|
||||
- (CPMenuItem)_createMenuItemWithTitle:(CPString )title
|
||||
{
|
||||
title = [[_ruleEditor standardLocalizer] localizedStringForString:title];
|
||||
var mItem = [[CPMenuItem alloc] initWithTitle:title action:nil keyEquivalent:@""];
|
||||
return mItem;
|
||||
return [[CPMenuItem alloc] initWithTitle:title action:nil keyEquivalent:@""];
|
||||
}
|
||||
|
||||
- (CPPopUpButton)_createPopUpButtonWithItems:(CPArray)itemsArray selectedItemIndex:(int)index
|
||||
{
|
||||
var title = [[itemsArray objectAtIndex:index] title],
|
||||
font = [_ruleEditor font],
|
||||
width = [title sizeWithFont:font].width + 20,
|
||||
rect = CGRectMake(0, 0, (width - width % 40) + 80, CONTROL_HEIGHT),
|
||||
var title = [[itemsArray objectAtIndex:index] title],
|
||||
font = [_ruleEditor font],
|
||||
width = [title sizeWithFont:font].width + 20,
|
||||
rect = CGRectMake(0, 0, (width - width % 40) + 80, [_ruleEditor rowHeight]),
|
||||
popup = [[CPPopUpButton alloc] initWithFrame:rect];
|
||||
|
||||
popup = [[_CPRuleEditorPopUpButton alloc] initWithFrame:rect];
|
||||
|
||||
[popup setTextColor:[CPColor colorWithWhite:101 / 255 alpha:1]];
|
||||
[popup setValue:font forThemeAttribute:@"font"];
|
||||
|
||||
var count = [itemsArray count];
|
||||
@@ -137,17 +142,17 @@ var CONTROL_HEIGHT = 16.,
|
||||
return [CPMenuItem separatorItem];
|
||||
}
|
||||
|
||||
- (_CPRuleEditorTextField)_createStaticTextFieldWithStringValue:(CPString)text
|
||||
- (CPTextField)_createStaticTextFieldWithStringValue:(CPString)text
|
||||
{
|
||||
var textField = [[_CPRuleEditorTextField alloc] initWithFrame:CGRectMakeZero()],
|
||||
ruleEditorFont = [_ruleEditor font],
|
||||
font = [CPFont fontWithName:[ruleEditorFont familyName] size:[ruleEditorFont size] + 2],
|
||||
localizedText = [[_ruleEditor standardLocalizer] localizedStringForString:text],
|
||||
size = [localizedText sizeWithFont:font];
|
||||
|
||||
[textField setFrameSize:CGSizeMake(size.width + 4, CONTROL_HEIGHT + 2)];
|
||||
var textField = [[CPTextField alloc] initWithFrame:CGRectMakeZero()],
|
||||
ruleEditorFont = [_ruleEditor font],
|
||||
font = [CPFont fontWithName:[ruleEditorFont familyName] size:[ruleEditorFont size] + 2],
|
||||
localizedText = [[_ruleEditor standardLocalizer] localizedStringForString:text],
|
||||
size = [localizedText sizeWithFont:font];
|
||||
|
||||
[textField setFrameSize:CGSizeMake(size.width + 4, [_ruleEditor rowHeight])];
|
||||
[textField setValue:font forThemeAttribute:@"font"];
|
||||
[textField setValue:[_ruleEditor _verticalAlignment] forThemeAttribute:@"vertical-alignment"];
|
||||
[textField setStringValue:localizedText];
|
||||
|
||||
return textField;
|
||||
@@ -159,6 +164,7 @@ var CONTROL_HEIGHT = 16.,
|
||||
[self setNeedsDisplay:YES];
|
||||
|
||||
var type = _plusButtonRowType;
|
||||
|
||||
if ([_ruleEditor nestingMode] == CPRuleEditorNestingModeCompound && ([[CPApp currentEvent] modifierFlags] & CPAlternateKeyMask))
|
||||
type = CPRuleEditorRowTypeCompound;
|
||||
|
||||
@@ -170,12 +176,12 @@ var CONTROL_HEIGHT = 16.,
|
||||
[_ruleEditor _deleteSlice:self];
|
||||
}
|
||||
|
||||
- (void)_ruleOptionPopupChangedAction:(CPMenuItem )sender
|
||||
- (void)_ruleOptionPopupChangedAction:(CPMenuItem)sender
|
||||
{
|
||||
var layoutdict = [sender representedObject],
|
||||
newItem = [layoutdict objectForKey:@"item"],
|
||||
var layoutdict = [sender representedObject],
|
||||
newItem = [layoutdict objectForKey:@"item"],
|
||||
indexInCriteria = [layoutdict objectForKey:@"indexInCriteria"],
|
||||
oldItem = [_correspondingRuleItems objectAtIndex:indexInCriteria];
|
||||
oldItem = [_correspondingRuleItems objectAtIndex:indexInCriteria];
|
||||
|
||||
if (![newItem isEqual:oldItem])
|
||||
{
|
||||
@@ -307,6 +313,8 @@ var CONTROL_HEIGHT = 16.,
|
||||
|
||||
if (ruleView != nil)
|
||||
{
|
||||
[ruleView setControlSize:CPSmallControlSize];
|
||||
|
||||
[_ruleOptionViews addObject:ruleView];
|
||||
var frame = [ruleView frame];
|
||||
[_ruleOptionInitialViewFrames addObject:frame];
|
||||
@@ -331,8 +339,6 @@ var CONTROL_HEIGHT = 16.,
|
||||
var aView = [_ruleOptionViews objectAtIndex:firstResponderIndex];
|
||||
[[self window] makeFirstResponder:aView]; // This is not working. bug in CPPopUpButton firstResponder ?
|
||||
}
|
||||
|
||||
//[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
- (void)_updateEnabledStateForSubviews
|
||||
@@ -350,14 +356,15 @@ var CONTROL_HEIGHT = 16.,
|
||||
var optionViewOriginX,
|
||||
leftHorizontalPadding,
|
||||
leftButtonMinX,
|
||||
rowHeight = [_ruleEditor rowHeight],
|
||||
count = [_ruleOptionViews count],
|
||||
sliceFrame = [self frame],
|
||||
rowHeight = [_ruleEditor rowHeight],
|
||||
count = [_ruleOptionViews count],
|
||||
sliceFrame = [self frame],
|
||||
image = [_ruleEditor _imageAdd],
|
||||
|
||||
buttonFrame = CGRectMake(CGRectGetWidth(sliceFrame) - BUTTON_HEIGHT - [self _rowButtonsRightHorizontalPadding], ([_ruleEditor rowHeight] - BUTTON_HEIGHT) / 2 - 2, BUTTON_HEIGHT, BUTTON_HEIGHT);
|
||||
buttonFrame = CGRectMake(CGRectGetWidth(sliceFrame) - [image size].width - [self _rowButtonsRightHorizontalPadding], ([_ruleEditor rowHeight] - [image size].height) / 2 - 1, [image size].width, [image size].height);
|
||||
|
||||
[_addButton setFrame:buttonFrame];
|
||||
buttonFrame.origin.x -= BUTTON_HEIGHT + [self _rowButtonsInterviewHorizontalPadding];
|
||||
buttonFrame.origin.x -= [image size].width + [self _rowButtonsInterviewHorizontalPadding];
|
||||
[_subtractButton setFrame:buttonFrame];
|
||||
|
||||
if (widthChanged)
|
||||
@@ -372,7 +379,8 @@ var CONTROL_HEIGHT = 16.,
|
||||
var ruleOptionView = _ruleOptionViews[i],
|
||||
optionFrame = _ruleOptionFrames[i];
|
||||
|
||||
optionFrame.origin.y = (rowHeight - CGRectGetHeight(optionFrame)) / 2 - 2;
|
||||
// Use a pixel correction to align controls
|
||||
optionFrame.origin.y = (rowHeight - CGRectGetHeight(optionFrame)) / 2;
|
||||
|
||||
if (widthChanged)
|
||||
{
|
||||
@@ -481,6 +489,26 @@ var CONTROL_HEIGHT = 16.,
|
||||
[self layoutSubviews];
|
||||
}
|
||||
|
||||
- (void)_addObservers
|
||||
{
|
||||
if (_isObserving)
|
||||
return;
|
||||
|
||||
[super _addObservers];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_textDidChange:) name:CPControlTextDidChangeNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)_removeObservers
|
||||
{
|
||||
if (!_isObserving)
|
||||
return;
|
||||
|
||||
[super _removeObservers];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPControlTextDidChangeNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)rect
|
||||
{
|
||||
[super drawRect:rect];
|
||||
@@ -488,8 +516,9 @@ var CONTROL_HEIGHT = 16.,
|
||||
|
||||
- (BOOL)_isRulePopup:(CPView)view
|
||||
{
|
||||
if ([view isKindOfClass:[_CPRuleEditorPopUpButton class]])
|
||||
if ([view isKindOfClass:[CPPopUpButton class]])
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -506,28 +535,3 @@ var CONTROL_HEIGHT = 16.,
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPRuleEditorTextField : CPTextField
|
||||
{
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self)
|
||||
{
|
||||
[self setDrawsBackground:NO];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CPView)hitTest:(CGPoint)point
|
||||
{
|
||||
if (!CGRectContainsPoint([self frame], point))
|
||||
return nil;
|
||||
|
||||
return [self superview];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
+1
-32
@@ -78,7 +78,6 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
|
||||
|
||||
@implementation CPScroller : CPControl
|
||||
{
|
||||
CPControlSize _controlSize;
|
||||
CPUsableScrollerParts _usableParts;
|
||||
CPArray _partRects;
|
||||
|
||||
@@ -172,7 +171,6 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
|
||||
{
|
||||
if (self = [super initWithFrame:aFrame])
|
||||
{
|
||||
_controlSize = CPRegularControlSize;
|
||||
_partRects = [];
|
||||
|
||||
[self setFloatValue:0.0];
|
||||
@@ -243,29 +241,6 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
|
||||
[super setObjectValue:MIN(1.0, MAX(0.0, +aValue))];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the scroller's control size
|
||||
*/
|
||||
- (CPControlSize)controlSize
|
||||
{
|
||||
return _controlSize;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the scroller's size.
|
||||
@param aControlSize the scroller's size
|
||||
*/
|
||||
- (void)setControlSize:(CPControlSize)aControlSize
|
||||
{
|
||||
if (_controlSize == aControlSize)
|
||||
return;
|
||||
|
||||
_controlSize = aControlSize;
|
||||
|
||||
[self setNeedsLayout];
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
/*!
|
||||
Return's the knob's proportion
|
||||
*/
|
||||
@@ -802,8 +777,7 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
|
||||
|
||||
@end
|
||||
|
||||
var CPScrollerControlSizeKey = @"CPScrollerControlSize",
|
||||
CPScrollerIsVerticalKey = @"CPScrollerIsVerticalKey",
|
||||
var CPScrollerIsVerticalKey = @"CPScrollerIsVerticalKey",
|
||||
CPScrollerKnobProportionKey = @"CPScrollerKnobProportion",
|
||||
CPScrollerStyleKey = @"CPScrollerStyleKey";
|
||||
|
||||
@@ -813,10 +787,6 @@ var CPScrollerControlSizeKey = @"CPScrollerControlSize",
|
||||
{
|
||||
if (self = [super initWithCoder:aCoder])
|
||||
{
|
||||
_controlSize = CPRegularControlSize;
|
||||
if ([aCoder containsValueForKey:CPScrollerControlSizeKey])
|
||||
_controlSize = [aCoder decodeIntForKey:CPScrollerControlSizeKey];
|
||||
|
||||
_knobProportion = 1.0;
|
||||
|
||||
if ([aCoder containsValueForKey:CPScrollerKnobProportionKey])
|
||||
@@ -851,7 +821,6 @@ var CPScrollerControlSizeKey = @"CPScrollerControlSize",
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
[aCoder encodeInt:_controlSize forKey:CPScrollerControlSizeKey];
|
||||
[aCoder encodeInt:_isVertical forKey:CPScrollerIsVerticalKey];
|
||||
[aCoder encodeFloat:_knobProportion forKey:CPScrollerKnobProportionKey];
|
||||
[aCoder encodeInt:_style forKey:CPScrollerStyleKey];
|
||||
|
||||
+18
-6
@@ -119,16 +119,28 @@ var RECENT_SEARCH_PREFIX = @" ";
|
||||
_canResignFirstResponder = YES;
|
||||
}
|
||||
|
||||
- (void)viewWillMoveToSuperview:(CPView)aView
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Override observers
|
||||
|
||||
- (void)_removeObservers
|
||||
{
|
||||
[super viewWillMoveToSuperview:aView];
|
||||
if (!_isObserving)
|
||||
return;
|
||||
|
||||
[super _removeObservers];
|
||||
|
||||
// First we remove any observer that may have been in place to avoid memory leakage.
|
||||
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPControlTextDidChangeNotification object:self];
|
||||
}
|
||||
|
||||
// Register the observe here if we need to.
|
||||
if (aView)
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_searchFieldTextDidChange:) name:CPControlTextDidChangeNotification object:self];
|
||||
- (void)_addObservers
|
||||
{
|
||||
if (_isObserving)
|
||||
return;
|
||||
|
||||
[super _addObservers];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_searchFieldTextDidChange:) name:CPControlTextDidChangeNotification object:self];
|
||||
}
|
||||
|
||||
// Managing Buttons
|
||||
|
||||
+95
-56
@@ -70,23 +70,9 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
@"center-segment-bezel-color": [CPNull null],
|
||||
@"divider-bezel-color": [CPNull null],
|
||||
@"divider-thickness": 1.0,
|
||||
@"default-height": 24.0,
|
||||
};
|
||||
}
|
||||
|
||||
+ (Class)_binderClassForBinding:(CPString)aBinding
|
||||
{
|
||||
if ([self _isSelectionBinding:aBinding])
|
||||
return [_CPSegmentedControlBinder class];
|
||||
|
||||
return [super _binderClassForBinding:aBinding];
|
||||
}
|
||||
|
||||
+ (BOOL)_isSelectionBinding:(CPString)aBinding
|
||||
{
|
||||
return (aBinding === CPSelectedIndexBinding || aBinding === CPSelectedLabelBinding || aBinding === CPSelectedTagBinding);
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)aRect
|
||||
{
|
||||
_segments = [];
|
||||
@@ -104,17 +90,14 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)bind:(CPString)aBinding toObject:(id)anObject withKeyPath:(CPString)aKeyPath options:(CPDictionary)options
|
||||
/*!
|
||||
Sets the control's size.
|
||||
@param aControlSize the control's size
|
||||
*/
|
||||
- (void)setControlSize:(CPControlSize)aControlSize
|
||||
{
|
||||
if ([[self class] _isSelectionBinding:aBinding] && _trackingMode !== CPSegmentSwitchTrackingSelectOne)
|
||||
CPLog.warn("Binding " + aBinding + " needs CPSegmentSwitchTrackingSelectOne tracking mode");
|
||||
else
|
||||
[super bind:aBinding toObject:anObject withKeyPath:aKeyPath options:options];
|
||||
}
|
||||
|
||||
- (void)_reverseSetBinding
|
||||
{
|
||||
[_CPSegmentedControlBinder reverseSetValueForObject:self];
|
||||
[super setControlSize:aControlSize];
|
||||
[self _sizeToControlSize];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -512,7 +495,7 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
|
||||
- (CGRect)rectForEphemeralSubviewNamed:(CPString)aName
|
||||
{
|
||||
var height = [self currentValueForThemeAttribute:@"default-height"],
|
||||
var height = [self currentValueForThemeAttribute:@"min-size"].height,
|
||||
contentInset = [self currentValueForThemeAttribute:@"content-inset"],
|
||||
bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"],
|
||||
bounds = [self bounds];
|
||||
@@ -577,10 +560,17 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
return;
|
||||
|
||||
var themeState = _themeStates[0],
|
||||
isDisabled = [self hasThemeState:CPThemeStateDisabled];
|
||||
isDisabled = [self hasThemeState:CPThemeStateDisabled],
|
||||
isControlSizeSmall = [self hasThemeState:CPThemeStateControlSizeSmall],
|
||||
isControlSizeMini = [self hasThemeState:CPThemeStateControlSizeMini];
|
||||
|
||||
themeState = isDisabled ? themeState.and(CPThemeStateDisabled) : themeState;
|
||||
|
||||
if (isControlSizeSmall)
|
||||
themeState = themeState.and(CPThemeStateControlSizeSmall);
|
||||
else if (isControlSizeMini)
|
||||
themeState = themeState.and(CPThemeStateControlSizeMini);
|
||||
|
||||
var leftCapColor = [self valueForThemeAttribute:@"left-segment-bezel-color"
|
||||
inState:themeState],
|
||||
|
||||
@@ -594,6 +584,11 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
|
||||
themeState = isDisabled ? themeState.and(CPThemeStateDisabled) : themeState;
|
||||
|
||||
if (isControlSizeSmall)
|
||||
themeState = themeState.and(CPThemeStateControlSizeSmall);
|
||||
else if (isControlSizeMini)
|
||||
themeState = themeState.and(CPThemeStateControlSizeMini);
|
||||
|
||||
var rightCapColor = [self valueForThemeAttribute:@"right-segment-bezel-color"
|
||||
inState:themeState],
|
||||
|
||||
@@ -609,6 +604,11 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
|
||||
themeState = isDisabled ? themeState.and(CPThemeStateDisabled) : themeState;
|
||||
|
||||
if (isControlSizeSmall)
|
||||
themeState = themeState.and(CPThemeStateControlSizeSmall);
|
||||
else if (isControlSizeMini)
|
||||
themeState = themeState.and(CPThemeStateControlSizeMini);
|
||||
|
||||
var bezelColor = [self valueForThemeAttribute:@"center-segment-bezel-color"
|
||||
inState:themeState],
|
||||
|
||||
@@ -618,7 +618,6 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
|
||||
[bezelView setBackgroundColor:bezelColor];
|
||||
|
||||
|
||||
// layout image/title views
|
||||
var segment = _segments[i],
|
||||
contentView = [self layoutEphemeralSubviewNamed:@"segment-content-" + i
|
||||
@@ -651,6 +650,11 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
|
||||
borderState = isDisabled ? borderState.and(CPThemeStateDisabled) : borderState;
|
||||
|
||||
if (isControlSizeSmall)
|
||||
borderState = borderState.and(CPThemeStateControlSizeSmall);
|
||||
else if (isControlSizeMini)
|
||||
borderState = borderState.and(CPThemeStateControlSizeMini);
|
||||
|
||||
var borderColor = [self valueForThemeAttribute:@"divider-bezel-color"
|
||||
inState:borderState],
|
||||
|
||||
@@ -707,7 +711,6 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
|
||||
// Update control size
|
||||
var frame = [self frame];
|
||||
|
||||
[self setFrameSize:CGSizeMake(CGRectGetWidth(frame) + delta, CGRectGetHeight(frame))];
|
||||
|
||||
// Update segment width
|
||||
@@ -743,7 +746,7 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
|
||||
- (CGRect)bezelFrameForSegment:(unsigned)aSegment
|
||||
{
|
||||
var height = [self currentValueForThemeAttribute:@"default-height"],
|
||||
var height = [self currentValueForThemeAttribute:@"min-size"].height,
|
||||
bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"],
|
||||
width = [self widthForSegment:aSegment],
|
||||
left = [self _leftOffsetForSegment:aSegment];
|
||||
@@ -753,7 +756,7 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
|
||||
- (CGRect)contentFrameForSegment:(unsigned)aSegment
|
||||
{
|
||||
var height = [self currentValueForThemeAttribute:@"default-height"],
|
||||
var height = [self currentValueForThemeAttribute:@"min-size"].height,
|
||||
contentInset = [self currentValueForThemeAttribute:@"content-inset"],
|
||||
width = [self widthForSegment:aSegment],
|
||||
left = [self _leftOffsetForSegment:aSegment];
|
||||
@@ -915,8 +918,7 @@ var CPSegmentedControlSegmentsKey = "CPSegmentedControlSegmentsKey",
|
||||
else
|
||||
_trackingMode = CPSegmentSwitchTrackingSelectOne;
|
||||
|
||||
// HACK
|
||||
|
||||
// Here we update the themeStates array for each segments to know if there are selected or not
|
||||
for (var i = 0; i < _segments.length; i++)
|
||||
_themeStates[i] = [_segments[i] selected] ? CPThemeStateSelected : CPThemeStateNormal;
|
||||
|
||||
@@ -924,12 +926,32 @@ var CPSegmentedControlSegmentsKey = "CPSegmentedControlSegmentsKey",
|
||||
for (var i = 0; i < _segments.length; i++)
|
||||
[self tileWithChangedSegment:i];
|
||||
|
||||
var difference = MAX(originalWidth - [self frame].size.width, 0.0),
|
||||
remainingWidth = FLOOR(difference / _segments.length);
|
||||
var thickness = [self currentValueForThemeAttribute:@"divider-thickness"],
|
||||
dividerExtraSpace = ([_segments count] - 1) * thickness,
|
||||
difference = MAX(originalWidth - [self frame].size.width - dividerExtraSpace, 0.0),
|
||||
remainingWidth = FLOOR(difference / _segments.length),
|
||||
widthOfAllSegments = 0;
|
||||
|
||||
for (var i = 0; i < _segments.length; i++)
|
||||
{
|
||||
[self setWidth:[_segments[i] width] + remainingWidth forSegment:i];
|
||||
widthOfAllSegments += [_segments[i] width];
|
||||
}
|
||||
|
||||
// Here we handle the leftovers pixel, and we will add one pixel to each segment cell till we have the same size as the originalSize.
|
||||
// This is needed to have a perfect/same alignment between our application and xCode.
|
||||
var leftOversPixel = originalWidth - (widthOfAllSegments + dividerExtraSpace);
|
||||
|
||||
// Make sure we don't make an out of range
|
||||
if (leftOversPixel < _segments.length - 1)
|
||||
{
|
||||
for (var i = 0; i < leftOversPixel; i++)
|
||||
{
|
||||
[self setWidth:[_segments[i] width] + 1 forSegment:i];
|
||||
}
|
||||
}
|
||||
|
||||
[self setFrameSize:CGSizeMake(originalWidth, [self frame].size.height)];
|
||||
[self tileWithChangedSegment:0];
|
||||
}
|
||||
|
||||
@@ -948,31 +970,48 @@ var CPSegmentedControlSegmentsKey = "CPSegmentedControlSegmentsKey",
|
||||
|
||||
@end
|
||||
|
||||
var CPSegmentedControlBindersMap = {},
|
||||
CPSegmentedControlNoSelectionPlaceholder = "CPSegmentedControlNoSelectionPlaceholder";
|
||||
@implementation CPSegmentedControl (BindingSupport)
|
||||
|
||||
+ (Class)_binderClassForBinding:(CPString)aBinding
|
||||
{
|
||||
if ([self _isSelectionBinding:aBinding])
|
||||
return [_CPSegmentedControlBinder class];
|
||||
|
||||
return [super _binderClassForBinding:aBinding];
|
||||
}
|
||||
|
||||
+ (BOOL)_isSelectionBinding:(CPString)aBinding
|
||||
{
|
||||
return (aBinding === CPSelectedIndexBinding || aBinding === CPSelectedLabelBinding || aBinding === CPSelectedTagBinding);
|
||||
}
|
||||
|
||||
+ (BOOL)isBindingExclusive:(CPString)aBinding
|
||||
{
|
||||
return [self _isSelectionBinding:aBinding];
|
||||
}
|
||||
|
||||
- (void)bind:(CPString)aBinding toObject:(id)anObject withKeyPath:(CPString)aKeyPath options:(CPDictionary)options
|
||||
{
|
||||
if ([[self class] _isSelectionBinding:aBinding] && _trackingMode !== CPSegmentSwitchTrackingSelectOne)
|
||||
{
|
||||
CPLog.warn("Binding " + aBinding + " needs CPSegmentSwitchTrackingSelectOne tracking mode");
|
||||
return;
|
||||
}
|
||||
|
||||
[super bind:aBinding toObject:anObject withKeyPath:aKeyPath options:options];
|
||||
}
|
||||
|
||||
- (void)_reverseSetBinding
|
||||
{
|
||||
[_CPSegmentedControlBinder _reverseSetValueFromExclusiveBinderForObject:self];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPSegmentedControlNoSelectionPlaceholder = "CPSegmentedControlNoSelectionPlaceholder";
|
||||
|
||||
@implementation _CPSegmentedControlBinder : CPBinder
|
||||
{
|
||||
CPString _selectionBinding @accessors(readonly, getter=selectionBinding);
|
||||
}
|
||||
|
||||
+ (void)reverseSetValueForObject:(id)aSource
|
||||
{
|
||||
var binder = CPSegmentedControlBindersMap[[aSource UID]];
|
||||
[binder reverseSetValueFor:[binder selectionBinding]];
|
||||
}
|
||||
|
||||
- (id)initWithBinding:(CPString)aBinding name:(CPString)aName to:(id)aDestination keyPath:(CPString)aKeyPath options:(CPDictionary)options from:(id)aSource
|
||||
{
|
||||
self = [super initWithBinding:aBinding name:aName to:aDestination keyPath:aKeyPath options:options from:aSource];
|
||||
|
||||
if (self)
|
||||
{
|
||||
CPSegmentedControlBindersMap[[aSource UID]] = self;
|
||||
_selectionBinding = aName;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)_updatePlaceholdersWithOptions:(CPDictionary)options
|
||||
|
||||
+21
-13
@@ -138,9 +138,16 @@
|
||||
[self setContinuous:_autorepeat];
|
||||
[self addSubview:_buttonDown];
|
||||
|
||||
[self _sizeToFit];
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)setControlSize:(CPControlSize)aControlSize
|
||||
{
|
||||
[super setControlSize:aControlSize];
|
||||
[self _sizeToFit];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Superclass overrides
|
||||
|
||||
@@ -159,8 +166,8 @@
|
||||
|
||||
- (void)setFrame:(CGRect)aFrame
|
||||
{
|
||||
var upSize = [self valueForThemeAttribute:@"up-button-size"],
|
||||
downSize = [self valueForThemeAttribute:@"down-button-size"],
|
||||
var upSize = [self currentValueForThemeAttribute:@"up-button-size"],
|
||||
downSize = [self currentValueForThemeAttribute:@"down-button-size"],
|
||||
minSize = CGSizeMake(upSize.width, upSize.height + downSize.height),
|
||||
frame = CGRectMakeCopy(aFrame);
|
||||
|
||||
@@ -172,21 +179,22 @@
|
||||
/*! @ignore */
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
var aFrame = [self frame],
|
||||
upSize = [self valueForThemeAttribute:@"up-button-size"],
|
||||
downSize = [self valueForThemeAttribute:@"down-button-size"],
|
||||
upFrame = CGRectMake(aFrame.size.width - upSize.width, 0, upSize.width, upSize.height),
|
||||
downFrame = CGRectMake(aFrame.size.width - downSize.width, upSize.height, downSize.width, downSize.height);
|
||||
var controlSizeThemeState = [self _controlSizeThemeState],
|
||||
aFrame = [self frame],
|
||||
upSize = [self valueForThemeAttribute:@"up-button-size" inState:controlSizeThemeState],
|
||||
downSize = [self valueForThemeAttribute:@"down-button-size" inState:controlSizeThemeState],
|
||||
upFrame = CGRectMake(0, 0, upSize.width, upSize.height),
|
||||
downFrame = CGRectMake(0, upSize.height, downSize.width, downSize.height);
|
||||
|
||||
[_buttonUp setFrame:upFrame];
|
||||
[_buttonDown setFrame:downFrame];
|
||||
|
||||
[_buttonUp setValue:[self valueForThemeAttribute:@"bezel-color-up-button" inState:CPThemeStateBordered] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
|
||||
[_buttonUp setValue:[self valueForThemeAttribute:@"bezel-color-up-button" inState:[CPThemeStateBordered, CPThemeStateDisabled]] forThemeAttribute:@"bezel-color" inState:[CPThemeStateBordered, CPThemeStateDisabled]];
|
||||
[_buttonUp setValue:[self valueForThemeAttribute:@"bezel-color-up-button" inState:[CPThemeStateBordered, CPThemeStateHighlighted]] forThemeAttribute:@"bezel-color" inState:[CPThemeStateBordered, CPThemeStateHighlighted]];
|
||||
[_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:CPThemeStateBordered] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
|
||||
[_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:[CPThemeStateBordered, CPThemeStateDisabled]] forThemeAttribute:@"bezel-color" inState:[CPThemeStateBordered, CPThemeStateDisabled]];
|
||||
[_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:[CPThemeStateBordered, CPThemeStateHighlighted]] forThemeAttribute:@"bezel-color" inState:[CPThemeStateBordered, CPThemeStateHighlighted]];
|
||||
[_buttonUp setValue:[self valueForThemeAttribute:@"bezel-color-up-button" inState:[controlSizeThemeState, CPThemeStateBordered]] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
|
||||
[_buttonUp setValue:[self valueForThemeAttribute:@"bezel-color-up-button" inState:[controlSizeThemeState, CPThemeStateBordered, CPThemeStateDisabled]] forThemeAttribute:@"bezel-color" inState:[CPThemeStateBordered, CPThemeStateDisabled]];
|
||||
[_buttonUp setValue:[self valueForThemeAttribute:@"bezel-color-up-button" inState:[controlSizeThemeState, CPThemeStateBordered, CPThemeStateHighlighted]] forThemeAttribute:@"bezel-color" inState:[CPThemeStateBordered, CPThemeStateHighlighted]];
|
||||
[_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:[controlSizeThemeState, CPThemeStateBordered]] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
|
||||
[_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:[controlSizeThemeState, CPThemeStateBordered, CPThemeStateDisabled]] forThemeAttribute:@"bezel-color" inState:[CPThemeStateBordered, CPThemeStateDisabled]];
|
||||
[_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:[controlSizeThemeState, CPThemeStateBordered, CPThemeStateHighlighted]] forThemeAttribute:@"bezel-color" inState:[CPThemeStateBordered, CPThemeStateHighlighted]];
|
||||
}
|
||||
|
||||
- (void)_sizeToFit
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
_tabs = [[CPSegmentedControl alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
|
||||
[_tabs setHitTests:NO];
|
||||
|
||||
var height = [_tabs valueForThemeAttribute:@"default-height"];
|
||||
var height = [_tabs valueForThemeAttribute:@"min-size"].height;
|
||||
[_tabs setFrameSize:CGSizeMake(0, height)];
|
||||
|
||||
_box = [[CPBox alloc] initWithFrame:[self bounds]];
|
||||
|
||||
+35
-4
@@ -473,8 +473,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
if (!_sortDescriptors)
|
||||
_sortDescriptors = [];
|
||||
|
||||
[self _startObservingFirstResponder];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -964,7 +962,7 @@ NOT YET IMPLEMENTED
|
||||
</pre>
|
||||
*/
|
||||
|
||||
- (void)unfocusedSelectionGradientColors
|
||||
- (CPColor)unfocusedSelectionGradientColors
|
||||
{
|
||||
if (!_unfocusedSourceListSelectionColor)
|
||||
{
|
||||
@@ -3950,6 +3948,9 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
// FIXME: yuck!
|
||||
var identifier = [aDataView identifier];
|
||||
|
||||
if ([aDataView hasThemeState:CPThemeStateSelectedDataView])
|
||||
[aDataView unsetThemeState:CPThemeStateSelectedDataView];
|
||||
|
||||
if (!_cachedDataViews[identifier])
|
||||
_cachedDataViews[identifier] = [aDataView];
|
||||
else
|
||||
@@ -4453,6 +4454,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
*/
|
||||
- (void)viewWillMoveToSuperview:(CPView)aView
|
||||
{
|
||||
[super viewWillMoveToSuperview:aView];
|
||||
|
||||
var superview = [self superview],
|
||||
defaultCenter = [CPNotificationCenter defaultCenter];
|
||||
|
||||
@@ -5120,11 +5123,34 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
var hit = [super hitTest:aPoint];
|
||||
|
||||
if ([[CPApp currentEvent] type] == CPLeftMouseDown && [hit acceptsFirstResponder] && ![self isRowSelected:[self rowForView:hit]])
|
||||
{
|
||||
if (_selectionHighlightStyle == CPTableViewSelectionHighlightStyleNone)
|
||||
return hit;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
- (void)_removeObservers
|
||||
{
|
||||
if (!_isObserving)
|
||||
return;
|
||||
|
||||
[super _removeObservers];
|
||||
[self _stopObservingFirstResponder];
|
||||
}
|
||||
|
||||
- (void)_addObservers
|
||||
{
|
||||
if (_isObserving)
|
||||
return;
|
||||
|
||||
[super _addObservers];
|
||||
[self _startObservingFirstResponder];
|
||||
}
|
||||
|
||||
- (void)_startObservingFirstResponder
|
||||
{
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_firstResponderDidChange:) name:_CPWindowDidChangeFirstResponderNotification object:[self window]];
|
||||
@@ -5156,7 +5182,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
// This makes sure the theming effects of a focused table remain in effect even as cells are being edited in it.
|
||||
[self _notifyViewDidBecomeFirstResponder];
|
||||
|
||||
if (_editingRow !== CPNotFound && [responder isKindOfClass:[CPTextField class]] && ![responder isBezeled])
|
||||
if (_editingRow !== CPNotFound && [responder isKindOfClass:[CPTextField class]] && ![responder isBezeled] && [responder isEditable])
|
||||
{
|
||||
[responder setBezeled:YES];
|
||||
[self _registerForEndEditingNote:responder];
|
||||
@@ -6004,6 +6030,11 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
// We do this in order to avoid encoding the _tableDrawView, which
|
||||
// should just automatically be created programmatically as needed.
|
||||
if (_tableDrawView)
|
||||
[_tableDrawView removeFromSuperview];
|
||||
|
||||
[aCoder encodeObject:_dataSource forKey:CPTableViewDataSourceKey];
|
||||
[aCoder encodeObject:_delegate forKey:CPTableViewDelegateKey];
|
||||
|
||||
|
||||
+280
-155
@@ -31,6 +31,7 @@
|
||||
|
||||
@global CPApp
|
||||
@global CPStringPboardType
|
||||
@global CPCursor
|
||||
|
||||
|
||||
@protocol CPTextFieldDelegate <CPControlTextEditingDelegate>
|
||||
@@ -46,9 +47,10 @@ CPTextFieldRoundedBezel = 1; /*! A textfield bezel with rounded corne
|
||||
CPTextFieldDidFocusNotification = @"CPTextFieldDidFocusNotification";
|
||||
CPTextFieldDidBlurNotification = @"CPTextFieldDidBlurNotification";
|
||||
|
||||
var CPTextFieldDOMInputElement = nil,
|
||||
CPTextFieldDOMPasswordInputElement = nil,
|
||||
var CPTextFieldDOMCurrentElement = nil,
|
||||
CPTextFieldDOMTextAreaElement = nil,
|
||||
CPTextFieldDOMStandardInputElement = nil,
|
||||
CPTextFieldDOMPasswordInputElement = nil,
|
||||
CPTextFieldInputOwner = nil,
|
||||
CPTextFieldTextDidChangeValue = nil,
|
||||
CPTextFieldInputResigning = NO,
|
||||
@@ -126,6 +128,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
BOOL _isSelectable;
|
||||
BOOL _isSecure;
|
||||
BOOL _willBecomeFirstResponderByClick;
|
||||
BOOL _invokedByUserEvent;
|
||||
|
||||
BOOL _drawsBackground;
|
||||
|
||||
@@ -140,7 +143,9 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
// NS-style Display Properties
|
||||
CPTextFieldBezelStyle _bezelStyle;
|
||||
BOOL _isBordered;
|
||||
CPControlSize _controlSize;
|
||||
BOOL _usesSingleLineMode;
|
||||
BOOL _wraps;
|
||||
BOOL _scrolls;
|
||||
}
|
||||
|
||||
+ (Class)_binderClassForBinding:(CPString)aBinding
|
||||
@@ -227,98 +232,124 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Control Size
|
||||
|
||||
- (void)setControlSize:(CPControlSize)aControlSize
|
||||
{
|
||||
[super setControlSize:aControlSize];
|
||||
|
||||
if ([self isBezeled])
|
||||
[self _sizeToControlSize];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
- (DOMElement)_inputElement
|
||||
{
|
||||
if (!CPTextFieldDOMInputElement)
|
||||
if (!CPTextFieldDOMTextAreaElement)
|
||||
{
|
||||
CPTextFieldDOMInputElement = document.createElement("input");
|
||||
CPTextFieldDOMInputElement.style.position = "absolute";
|
||||
CPTextFieldDOMInputElement.style.border = "0px";
|
||||
CPTextFieldDOMInputElement.style.padding = "0px";
|
||||
CPTextFieldDOMInputElement.style.margin = "0px";
|
||||
CPTextFieldDOMInputElement.style.whiteSpace = "pre";
|
||||
CPTextFieldDOMInputElement.style.background = "transparent";
|
||||
CPTextFieldDOMInputElement.style.outline = "none";
|
||||
CPTextFieldDOMTextAreaElement = document.createElement("textarea");
|
||||
CPTextFieldDOMTextAreaElement.style.position = "absolute";
|
||||
CPTextFieldDOMTextAreaElement.style.border = "0px";
|
||||
CPTextFieldDOMTextAreaElement.style.padding = "0px";
|
||||
CPTextFieldDOMTextAreaElement.style.margin = "0px";
|
||||
CPTextFieldDOMTextAreaElement.style.background = "transparent";
|
||||
CPTextFieldDOMTextAreaElement.style.outline = "none";
|
||||
CPTextFieldDOMTextAreaElement.style.resize = "none";
|
||||
CPTextFieldDOMTextAreaElement.style.overflow = "hidden";
|
||||
CPTextFieldDOMTextAreaElement.spellcheck = NO;
|
||||
}
|
||||
|
||||
if (!CPTextFieldDOMStandardInputElement)
|
||||
{
|
||||
CPTextFieldDOMStandardInputElement = document.createElement("input");
|
||||
CPTextFieldDOMStandardInputElement.style.position = "absolute";
|
||||
CPTextFieldDOMStandardInputElement.style.border = "0px";
|
||||
CPTextFieldDOMStandardInputElement.style.padding = "0px";
|
||||
CPTextFieldDOMStandardInputElement.style.margin = "0px";
|
||||
CPTextFieldDOMStandardInputElement.style.whiteSpace = "pre";
|
||||
CPTextFieldDOMStandardInputElement.style.background = "transparent";
|
||||
CPTextFieldDOMStandardInputElement.style.outline = "none";
|
||||
CPTextFieldDOMStandardInputElement.spellcheck = NO;
|
||||
}
|
||||
|
||||
if (!CPTextFieldDOMPasswordInputElement)
|
||||
{
|
||||
CPTextFieldDOMPasswordInputElement = document.createElement("input");
|
||||
CPTextFieldDOMPasswordInputElement.style.position = "absolute";
|
||||
CPTextFieldDOMPasswordInputElement.style.border = "0px";
|
||||
CPTextFieldDOMPasswordInputElement.style.padding = "0px";
|
||||
CPTextFieldDOMPasswordInputElement.style.margin = "0px";
|
||||
CPTextFieldDOMPasswordInputElement.style.whiteSpace = "pre";
|
||||
CPTextFieldDOMPasswordInputElement.style.background = "transparent";
|
||||
CPTextFieldDOMPasswordInputElement.style.outline = "none";
|
||||
CPTextFieldDOMPasswordInputElement.type = "password";
|
||||
CPTextFieldDOMPasswordInputElement.spellcheck = NO;
|
||||
}
|
||||
|
||||
if (!CPTextFieldBlurHandler)
|
||||
{
|
||||
CPTextFieldBlurHandler = function(anEvent)
|
||||
{
|
||||
return CPTextFieldBlurFunction(
|
||||
anEvent,
|
||||
CPTextFieldInputOwner,
|
||||
CPTextFieldInputOwner ? CPTextFieldInputOwner._DOMElement : nil,
|
||||
CPTextFieldDOMInputElement,
|
||||
CPTextFieldDOMCurrentElement,
|
||||
CPTextFieldInputResigning,
|
||||
@ref(CPTextFieldInputDidBlur));
|
||||
};
|
||||
}
|
||||
|
||||
if (CPFeatureIsCompatible(CPInputOnInputEventFeature))
|
||||
if (!CPTextFieldInputFunction)
|
||||
{
|
||||
if (!CPFeatureIsCompatible(CPInputOnInputEventFeature))
|
||||
return;
|
||||
|
||||
CPTextFieldInputFunction = function(anEvent)
|
||||
{
|
||||
CPTextFieldInputFunction = function(anEvent)
|
||||
{
|
||||
if (!CPTextFieldInputOwner)
|
||||
return;
|
||||
if (!CPTextFieldInputOwner)
|
||||
return;
|
||||
|
||||
var cappEvent = [CPEvent keyEventWithType:CPKeyUp
|
||||
location:CGPointMakeZero()
|
||||
modifierFlags:0
|
||||
timestamp:[CPEvent currentTimestamp]
|
||||
windowNumber:[[CPApp keyWindow] windowNumber]
|
||||
context:nil
|
||||
characters:nil
|
||||
charactersIgnoringModifiers:nil
|
||||
isARepeat:NO
|
||||
keyCode:nil];
|
||||
var cappEvent = [CPEvent keyEventWithType:CPKeyUp
|
||||
location:CGPointMakeZero()
|
||||
modifierFlags:0
|
||||
timestamp:[CPEvent currentTimestamp]
|
||||
windowNumber:[[CPApp keyWindow] windowNumber]
|
||||
context:nil
|
||||
characters:nil
|
||||
charactersIgnoringModifiers:nil
|
||||
isARepeat:NO
|
||||
keyCode:nil];
|
||||
|
||||
[CPTextFieldInputOwner keyUp:cappEvent];
|
||||
[CPTextFieldInputOwner keyUp:cappEvent];
|
||||
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
CPTextFieldDOMInputElement.oninput = CPTextFieldInputFunction;
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
// FIXME make this not onblur
|
||||
CPTextFieldDOMInputElement.onblur = CPTextFieldBlurHandler;
|
||||
CPTextFieldDOMPasswordInputElement.oninput = CPTextFieldInputFunction;
|
||||
CPTextFieldDOMPasswordInputElement.onblur = CPTextFieldBlurHandler;
|
||||
|
||||
CPTextFieldDOMStandardInputElement = CPTextFieldDOMInputElement;
|
||||
CPTextFieldDOMStandardInputElement.oninput = CPTextFieldInputFunction;
|
||||
CPTextFieldDOMPasswordInputElement.onblur = CPTextFieldBlurHandler;
|
||||
|
||||
CPTextFieldDOMTextAreaElement.oninput = CPTextFieldInputFunction;
|
||||
CPTextFieldDOMTextAreaElement.onblur = CPTextFieldBlurHandler;
|
||||
}
|
||||
|
||||
if (CPFeatureIsCompatible(CPInputTypeCanBeChangedFeature))
|
||||
{
|
||||
if ([self isSecure])
|
||||
CPTextFieldDOMInputElement.type = "password";
|
||||
else
|
||||
CPTextFieldDOMInputElement.type = "text";
|
||||
|
||||
return CPTextFieldDOMInputElement;
|
||||
}
|
||||
|
||||
if ([self isSecure])
|
||||
{
|
||||
if (!CPTextFieldDOMPasswordInputElement)
|
||||
{
|
||||
CPTextFieldDOMPasswordInputElement = document.createElement("input");
|
||||
CPTextFieldDOMPasswordInputElement.style.position = "absolute";
|
||||
CPTextFieldDOMPasswordInputElement.style.border = "0px";
|
||||
CPTextFieldDOMPasswordInputElement.style.padding = "0px";
|
||||
CPTextFieldDOMPasswordInputElement.style.margin = "0px";
|
||||
CPTextFieldDOMPasswordInputElement.style.whiteSpace = "pre";
|
||||
CPTextFieldDOMPasswordInputElement.style.background = "transparent";
|
||||
CPTextFieldDOMPasswordInputElement.style.outline = "none";
|
||||
CPTextFieldDOMPasswordInputElement.type = "password";
|
||||
|
||||
CPTextFieldDOMPasswordInputElement.onblur = CPTextFieldBlurHandler;
|
||||
}
|
||||
|
||||
CPTextFieldDOMInputElement = CPTextFieldDOMPasswordInputElement;
|
||||
}
|
||||
CPTextFieldDOMCurrentElement = CPTextFieldDOMPasswordInputElement;
|
||||
else if (_usesSingleLineMode)
|
||||
CPTextFieldDOMCurrentElement = CPTextFieldDOMStandardInputElement;
|
||||
else
|
||||
{
|
||||
CPTextFieldDOMInputElement = CPTextFieldDOMStandardInputElement;
|
||||
}
|
||||
CPTextFieldDOMCurrentElement = CPTextFieldDOMTextAreaElement;
|
||||
|
||||
return CPTextFieldDOMInputElement;
|
||||
return CPTextFieldDOMCurrentElement;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -537,6 +568,24 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
return _textFieldBackgroundColor;
|
||||
}
|
||||
|
||||
/*! @ignore */
|
||||
- (void)_setUsesSingleLineMode:(BOOL)aFlag
|
||||
{
|
||||
_usesSingleLineMode = aFlag;
|
||||
}
|
||||
|
||||
/*! @ignore */
|
||||
- (void)_setWraps:(BOOL)aFlag
|
||||
{
|
||||
_wraps = aFlag;
|
||||
}
|
||||
|
||||
/*! @ignore */
|
||||
- (void)_setScrolls:(BOOL)aFlag
|
||||
{
|
||||
_scrolls = aFlag;
|
||||
}
|
||||
|
||||
/*! @ignore */
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
@@ -592,28 +641,10 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
[self _setCSSStyleForInputElement];
|
||||
|
||||
var element = [self _inputElement],
|
||||
font = [self currentValueForThemeAttribute:@"font"],
|
||||
contentRect = [self contentRectForBounds:[self bounds]],
|
||||
left = CGRectGetMinX(contentRect);
|
||||
|
||||
var element = [self _inputElement];
|
||||
element.value = _stringValue;
|
||||
|
||||
// If the browser has a built in left padding, compensate for it. We need the input text to be exactly on top of the original text.
|
||||
if (CPFeatureIsCompatible(CPInput1PxLeftPadding))
|
||||
left -= 1;
|
||||
|
||||
element.style.left = left + "px";
|
||||
element.style.width = CGRectGetWidth(contentRect) + "px";
|
||||
element.style.verticalAlign = "top";
|
||||
element.style.cursor = "auto";
|
||||
|
||||
_DOMElement.appendChild(element);
|
||||
|
||||
// The font change above doesn't work for some browsers if the element isn't already appendChild'ed.
|
||||
if (!CPFeatureIsCompatible(CPInputSetFontOutsideOfDOM))
|
||||
element.style.font = [font cssString];
|
||||
|
||||
CPTextFieldInputIsActive = YES;
|
||||
|
||||
if (document.attachEvent)
|
||||
@@ -657,37 +688,18 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
*/
|
||||
- (void)_setCSSStyleForInputElement
|
||||
{
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
var element = [self _inputElement],
|
||||
font = [self currentValueForThemeAttribute:@"font"],
|
||||
lineHeight = [font defaultLineHeightForFont],
|
||||
contentRect = [self contentRectForBounds:[self bounds]],
|
||||
verticalAlign = [self currentValueForThemeAttribute:"vertical-alignment"];
|
||||
|
||||
if ([self hasThemeState:CPTextFieldStatePlaceholder])
|
||||
element.style.color = [[self valueForThemeAttribute:@"text-color" inState:CPTextFieldStatePlaceholder] cssString];
|
||||
else
|
||||
element.style.color = [[self valueForThemeAttribute:@"text-color" inState:CPThemeStateEditing] cssString];
|
||||
var element = [self _inputElement],
|
||||
font = [self currentValueForThemeAttribute:@"font"],
|
||||
lineHeight = [font defaultLineHeightForFont],
|
||||
contentRect = [self contentRectForBounds:[self bounds]],
|
||||
verticalAlign = [self currentValueForThemeAttribute:"vertical-alignment"],
|
||||
left = CGRectGetMinX(contentRect);
|
||||
|
||||
if (CPFeatureIsCompatible(CPInputSetFontOutsideOfDOM))
|
||||
element.style.font = [font cssString];
|
||||
|
||||
element.style.zIndex = 1000;
|
||||
|
||||
switch ([self alignment])
|
||||
{
|
||||
case CPCenterTextAlignment:
|
||||
element.style.textAlign = "center";
|
||||
break;
|
||||
|
||||
case CPRightTextAlignment:
|
||||
element.style.textAlign = "right";
|
||||
break;
|
||||
|
||||
default:
|
||||
element.style.textAlign = "left";
|
||||
}
|
||||
// If the browser has a built in left padding, compensate for it. We need the input text to be exactly on top of the original text.
|
||||
if (CPFeatureIsCompatible(CPInput1PxLeftPadding))
|
||||
left -= 1;
|
||||
|
||||
switch (verticalAlign)
|
||||
{
|
||||
@@ -708,12 +720,41 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
break;
|
||||
}
|
||||
|
||||
element.style.top = topPoint;
|
||||
element.style.height = ROUND(lineHeight) + "px";
|
||||
element.style.lineHeight = ROUND(lineHeight) + "px";
|
||||
if ([self hasThemeState:CPTextFieldStatePlaceholder])
|
||||
element.style.color = [[self valueForThemeAttribute:@"text-color" inState:CPTextFieldStatePlaceholder] cssString];
|
||||
else
|
||||
element.style.color = [[self valueForThemeAttribute:@"text-color" inState:CPThemeStateEditing] cssString];
|
||||
|
||||
switch ([self alignment])
|
||||
{
|
||||
case CPCenterTextAlignment:
|
||||
element.style.textAlign = "center";
|
||||
break;
|
||||
|
||||
case CPRightTextAlignment:
|
||||
element.style.textAlign = "right";
|
||||
break;
|
||||
|
||||
default:
|
||||
element.style.textAlign = "left";
|
||||
}
|
||||
|
||||
var isTextArea = element.nodeName.toUpperCase() == "TEXTAREA";
|
||||
|
||||
element.style.zIndex = 1000;
|
||||
element.style.top = topPoint;
|
||||
element.style.lineHeight = ROUND(lineHeight) + "px";
|
||||
element.style.height = isTextArea ? CGRectGetHeight(contentRect) + "px" : ROUND(lineHeight) + "px";;
|
||||
element.style.width = CGRectGetWidth(contentRect) + "px";
|
||||
element.style.left = left + "px";
|
||||
element.style.verticalAlign = "top";
|
||||
element.style.cursor = "auto";
|
||||
element.style.font = [font cssString];
|
||||
|
||||
if (isTextArea)
|
||||
element.style.whiteSpace = _wraps ? "pre" : "nowrap";
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*! @ignore */
|
||||
@@ -819,6 +860,26 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_removeObservers
|
||||
{
|
||||
if (!_isObserving)
|
||||
return;
|
||||
|
||||
[super _removeObservers];
|
||||
[self _setObserveWindowKeyNotifications:NO];
|
||||
}
|
||||
|
||||
- (void)_addObservers
|
||||
{
|
||||
if (_isObserving)
|
||||
return;
|
||||
|
||||
[super _addObservers];
|
||||
|
||||
if ([self window] === self)
|
||||
[self _setObserveWindowKeyNotifications:YES];
|
||||
}
|
||||
|
||||
- (void)_windowDidResignKey:(CPNotification)aNotification
|
||||
{
|
||||
if (![[self window] isKeyWindow])
|
||||
@@ -887,6 +948,12 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
[self textDidChange:[CPNotification notificationWithName:CPControlTextDidChangeNotification object:self userInfo:nil]];
|
||||
}
|
||||
|
||||
- (void)mouseMoved:(CPEvent)anEvent
|
||||
{
|
||||
[super mouseMoved:anEvent];
|
||||
[self _updateCursorForEvent:anEvent];
|
||||
}
|
||||
|
||||
- (void)mouseDown:(CPEvent)anEvent
|
||||
{
|
||||
// Don't track! (ever?)
|
||||
@@ -957,7 +1024,6 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
if (newValue !== _stringValue)
|
||||
{
|
||||
[self _setStringValue:newValue];
|
||||
|
||||
[self _didEdit];
|
||||
}
|
||||
|
||||
@@ -967,13 +1033,20 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
- (void)keyDown:(CPEvent)anEvent
|
||||
{
|
||||
if (!([self isEnabled] && [self isEditable]))
|
||||
return;
|
||||
|
||||
// CPTextField uses an HTML input element to take the input so we need to
|
||||
// propagate the dom event so the element is updated. This has to be done
|
||||
// before interpretKeyEvents: though so individual commands have a chance
|
||||
// to override this (escape to clear the text in a search field for example).
|
||||
[[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
|
||||
|
||||
// Set a flag so that key handling methods (such as deleteBackward:)
|
||||
// know they were invoked from a user event.
|
||||
_invokedByUserEvent = !!anEvent._DOMEvent;
|
||||
[self interpretKeyEvents:[anEvent]];
|
||||
_invokedByUserEvent = NO;
|
||||
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
}
|
||||
@@ -1051,7 +1124,11 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
range = [self selectedRange],
|
||||
element = [self _inputElement];
|
||||
|
||||
element.value = [element.value stringByReplacingCharactersInRange:[self selectedRange] withString:aCharacter];
|
||||
// we don't need to do this in case of textarea
|
||||
// or we will end up with 2 carriage returns
|
||||
if (aCharacter != CPNewlineCharacter || element.nodeName.toUpperCase() != "TEXTAREA" || !CPFeatureIsCompatible(CPAltEnterTextAreaFeature))
|
||||
element.value = [element.value stringByReplacingCharactersInRange:[self selectedRange] withString:aCharacter];
|
||||
|
||||
[self _setStringValue:element.value];
|
||||
|
||||
// NOTE: _stringValue is now the current input element value
|
||||
@@ -1091,6 +1168,27 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
[super textDidChange:note];
|
||||
}
|
||||
|
||||
- (void)_updateCursorForEvent:(CPEvent)anEvent
|
||||
{
|
||||
var frame = CGRectMakeCopy([self frame]),
|
||||
contentInset = [self currentValueForThemeAttribute:@"content-inset"];
|
||||
|
||||
frame = [[self superview] convertRectToBase:CGRectInsetByInset(frame, contentInset)];
|
||||
|
||||
if ([self isEnabled] && ([self isSelectable] || [self isEditable]) && CGRectContainsPoint(frame, [anEvent locationInWindow]))
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
self._DOMElement.style.cursor = "text";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
self._DOMElement.style.cursor = "default";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the string in the text field.
|
||||
*/
|
||||
@@ -1147,12 +1245,17 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
}
|
||||
|
||||
- (void)setObjectValue:(id)aValue
|
||||
{
|
||||
[self _setObjectValue:aValue useFormatter:YES];
|
||||
}
|
||||
|
||||
- (void)_setObjectValue:(id)aValue useFormatter:(BOOL)useFormatter
|
||||
{
|
||||
[super setObjectValue:aValue];
|
||||
|
||||
var formatter = [self formatter];
|
||||
|
||||
if (formatter)
|
||||
if (useFormatter && formatter)
|
||||
{
|
||||
// If there is a formatter, make sure the object value can be formatted successfully
|
||||
var formattedString = [self hasThemeState:CPThemeStateEditing] ? [formatter editingStringForObjectValue:aValue] : [formatter stringForObjectValue:aValue];
|
||||
@@ -1537,7 +1640,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
var selectedRange = [self selectedRange];
|
||||
|
||||
if (selectedRange.length < 1)
|
||||
if (selectedRange.length === 0)
|
||||
{
|
||||
if (selectedRange.location < 1)
|
||||
return;
|
||||
@@ -1547,19 +1650,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
selectedRange.length += 1;
|
||||
}
|
||||
|
||||
var newValue = [_stringValue stringByReplacingCharactersInRange:selectedRange withString:""];
|
||||
|
||||
[self setStringValue:newValue];
|
||||
[self setSelectedRange:CPMakeRange(selectedRange.location, 0)];
|
||||
[self _didEdit];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
// Since we just performed the deletion manually, we don't need the browser to do anything else.
|
||||
// (Previously we would allow the event to propagate for the browser to delete 1 character only,
|
||||
// and we'd delete the rest manually. But this meant that if deleteBackward: was called without
|
||||
// it being a browser backspace event, 1 character would be left behind.)
|
||||
[[[self window] platformWindow] _propagateCurrentDOMEvent:NO];
|
||||
#endif
|
||||
[self _replaceCharactersInRange:selectedRange withCharacters:@""];
|
||||
}
|
||||
|
||||
- (void)delete:(id)sender
|
||||
@@ -1573,16 +1664,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
if (selectedRange.length < 1)
|
||||
return;
|
||||
|
||||
var newValue = [_stringValue stringByReplacingCharactersInRange:selectedRange withString:""];
|
||||
|
||||
[self setStringValue:newValue];
|
||||
[self setSelectedRange:CPMakeRange(selectedRange.location, 0)];
|
||||
[self _didEdit];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
// Since we just performed the deletion manually, we don't need the browser to do anything else.
|
||||
[[[self window] platformWindow] _propagateCurrentDOMEvent:NO];
|
||||
#endif
|
||||
[self _replaceCharactersInRange:selectedRange withCharacters:@""];
|
||||
}
|
||||
|
||||
- (void)deleteForward:(id)sender
|
||||
@@ -1592,24 +1674,38 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
var selectedRange = [self selectedRange];
|
||||
|
||||
if (selectedRange.length < 1)
|
||||
if (selectedRange.length === 0)
|
||||
{
|
||||
if (selectedRange.location + 1 >= _stringValue.length)
|
||||
if (selectedRange.location >= _stringValue.length)
|
||||
return;
|
||||
|
||||
// Delete a single element forward from the insertion point if there's no selection.
|
||||
selectedRange.length += 1;
|
||||
}
|
||||
|
||||
var newValue = [_stringValue stringByReplacingCharactersInRange:selectedRange withString:""];
|
||||
[self _replaceCharactersInRange:selectedRange withCharacters:@""];
|
||||
}
|
||||
|
||||
[self setStringValue:newValue];
|
||||
[self setSelectedRange:CPMakeRange(selectedRange.location, 0)];
|
||||
[self _didEdit];
|
||||
- (void)_replaceCharactersInRange:(CPRange)range withCharacters:(CPString)characters
|
||||
{
|
||||
var newValue = [_stringValue stringByReplacingCharactersInRange:range withString:characters];
|
||||
|
||||
if (_invokedByUserEvent)
|
||||
{
|
||||
[self _setStringValue:newValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self _setObjectValue:newValue useFormatter:NO];
|
||||
[self setSelectedRange:CPMakeRange(range.location, 0)];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
// Since we just performed the deletion manually, we don't need the browser to do anything else.
|
||||
[[[self window] platformWindow] _propagateCurrentDOMEvent:NO];
|
||||
// Since we just performed the deletion manually, we don't need the browser to do anything else.
|
||||
[[[self window] platformWindow] _propagateCurrentDOMEvent:NO];
|
||||
#endif
|
||||
}
|
||||
|
||||
[self _didEdit];
|
||||
}
|
||||
|
||||
#pragma mark Setting the Delegate
|
||||
@@ -1845,7 +1941,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
if (!wind)
|
||||
return NO;
|
||||
|
||||
var frame = [self convertRectToBase:[self bounds]],
|
||||
var frame = [self convertRectToBase:[self contentRectForBounds:[self bounds]]],
|
||||
usableRect = [[wind platformWindow] usableContentFrame];
|
||||
|
||||
frame.origin = [wind convertBaseToGlobal:frame.origin];
|
||||
@@ -1877,7 +1973,11 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
|
||||
CPTextFieldLineBreakModeKey = "CPTextFieldLineBreakModeKey",
|
||||
CPTextFieldAlignmentKey = "CPTextFieldAlignmentKey",
|
||||
CPTextFieldBackgroundColorKey = "CPTextFieldBackgroundColorKey",
|
||||
CPTextFieldPlaceholderStringKey = "CPTextFieldPlaceholderStringKey";
|
||||
CPTextFieldPlaceholderStringKey = "CPTextFieldPlaceholderStringKey",
|
||||
CPTextFieldUsesSingleLineMode = "CPTextFieldUsesSingleLineMode",
|
||||
CPTextFieldWraps = "CPTextFieldWraps",
|
||||
CPTextFieldScrolls = "CPTextFieldScrolls";
|
||||
|
||||
|
||||
@implementation CPTextField (CPCoding)
|
||||
|
||||
@@ -1903,6 +2003,10 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
|
||||
[self setAlignment:[aCoder decodeIntForKey:CPTextFieldAlignmentKey]];
|
||||
|
||||
[self setPlaceholderString:[aCoder decodeObjectForKey:CPTextFieldPlaceholderStringKey]];
|
||||
|
||||
[self _setUsesSingleLineMode:[aCoder decodeBoolForKey:CPTextFieldUsesSingleLineMode]];
|
||||
[self _setWraps:[aCoder decodeBoolForKey:CPTextFieldWraps]];
|
||||
[self _setScrolls:[aCoder decodeBoolForKey:CPTextFieldScrolls]];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -1927,6 +2031,10 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
|
||||
[aCoder encodeInt:[self alignment] forKey:CPTextFieldAlignmentKey];
|
||||
|
||||
[aCoder encodeObject:_placeholderString forKey:CPTextFieldPlaceholderStringKey];
|
||||
|
||||
[aCoder encodeBool:_usesSingleLineMode forKey:CPTextFieldUsesSingleLineMode];
|
||||
[aCoder encodeBool:_wraps forKey:CPTextFieldWraps];
|
||||
[aCoder encodeBool:_scrolls forKey:CPTextFieldScrolls];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1957,6 +2065,23 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
|
||||
[_source setObjectValue:aValue];
|
||||
}
|
||||
|
||||
- (void)reverseSetValueFor:(CPString)aBinding
|
||||
{
|
||||
var destination = [_info objectForKey:CPObservedObjectKey],
|
||||
keyPath = [_info objectForKey:CPObservedKeyPathKey],
|
||||
options = [_info objectForKey:CPOptionsKey],
|
||||
newValue = [self valueForBinding:aBinding],
|
||||
value = [destination valueForKeyPath:keyPath];
|
||||
|
||||
if (CPIsControllerMarker(value) && newValue === nil) return;
|
||||
|
||||
newValue = [self reverseTransformValue:newValue withOptions:options];
|
||||
|
||||
[self suppressSpecificNotificationFromObject:destination keyPath:keyPath];
|
||||
[destination setValue:newValue forKeyPath:keyPath];
|
||||
[self unsuppressSpecificNotificationFromObject:destination keyPath:keyPath];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPTextFieldPatternValueBinder : CPValueWithPatternBinding
|
||||
|
||||
+22
-19
@@ -499,25 +499,28 @@ function CPThemeState()
|
||||
|
||||
@end
|
||||
|
||||
CPThemeStateNormal = CPThemeState("normal");
|
||||
CPThemeStateDisabled = CPThemeState("disabled");
|
||||
CPThemeStateHovered = CPThemeState("hovered");
|
||||
CPThemeStateHighlighted = CPThemeState("highlighted");
|
||||
CPThemeStateSelected = CPThemeState("selected");
|
||||
CPThemeStateTableDataView = CPThemeState("tableDataView");
|
||||
CPThemeStateSelectedDataView = CPThemeState("selectedTableDataView");
|
||||
CPThemeStateGroupRow = CPThemeState("CPThemeStateGroupRow");
|
||||
CPThemeStateBezeled = CPThemeState("bezeled");
|
||||
CPThemeStateBordered = CPThemeState("bordered");
|
||||
CPThemeStateEditable = CPThemeState("editable");
|
||||
CPThemeStateEditing = CPThemeState("editing");
|
||||
CPThemeStateVertical = CPThemeState("vertical");
|
||||
CPThemeStateDefault = CPThemeState("default");
|
||||
CPThemeStateCircular = CPThemeState("circular");
|
||||
CPThemeStateAutocompleting = CPThemeState("autocompleting");
|
||||
CPThemeStateFirstResponder = CPThemeState("firstResponder");
|
||||
CPThemeStateMainWindow = CPThemeState("mainWindow");
|
||||
CPThemeStateKeyWindow = CPThemeState("keyWindow");
|
||||
CPThemeStateNormal = CPThemeState("normal");
|
||||
CPThemeStateDisabled = CPThemeState("disabled");
|
||||
CPThemeStateHovered = CPThemeState("hovered");
|
||||
CPThemeStateHighlighted = CPThemeState("highlighted");
|
||||
CPThemeStateSelected = CPThemeState("selected");
|
||||
CPThemeStateTableDataView = CPThemeState("tableDataView");
|
||||
CPThemeStateSelectedDataView = CPThemeState("selectedTableDataView");
|
||||
CPThemeStateGroupRow = CPThemeState("CPThemeStateGroupRow");
|
||||
CPThemeStateBezeled = CPThemeState("bezeled");
|
||||
CPThemeStateBordered = CPThemeState("bordered");
|
||||
CPThemeStateEditable = CPThemeState("editable");
|
||||
CPThemeStateEditing = CPThemeState("editing");
|
||||
CPThemeStateVertical = CPThemeState("vertical");
|
||||
CPThemeStateDefault = CPThemeState("default");
|
||||
CPThemeStateCircular = CPThemeState("circular");
|
||||
CPThemeStateAutocompleting = CPThemeState("autocompleting");
|
||||
CPThemeStateFirstResponder = CPThemeState("firstResponder");
|
||||
CPThemeStateMainWindow = CPThemeState("mainWindow");
|
||||
CPThemeStateKeyWindow = CPThemeState("keyWindow");
|
||||
CPThemeStateControlSizeRegular = CPThemeState("controlSizeRegular");
|
||||
CPThemeStateControlSizeSmall = CPThemeState("controlSizeSmall");
|
||||
CPThemeStateControlSizeMini = CPThemeState("controlSizeMini");
|
||||
|
||||
@implementation _CPThemeAttribute : CPObject
|
||||
{
|
||||
|
||||
+101
-25
@@ -228,6 +228,8 @@ var CPViewFlags = { },
|
||||
Function _toolTipFunctionIn;
|
||||
Function _toolTipFunctionOut;
|
||||
BOOL _toolTipInstalled;
|
||||
|
||||
BOOL _isObserving;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -508,8 +510,12 @@ var CPViewFlags = { },
|
||||
[CPException raise:CPInvalidArgumentException reason:"can't insert a subview in duplicate (probably partially decoded)"];
|
||||
#endif
|
||||
|
||||
// Notify the subview that it will be moving.
|
||||
[aSubview viewWillMoveToSuperview:self];
|
||||
|
||||
// We will have to adjust the z-index of all views starting at this index.
|
||||
var count = _subviews.length;
|
||||
var count = _subviews.length,
|
||||
lastWindow;
|
||||
|
||||
// Dirty the key view loop, in case the window wants to auto recalculate it
|
||||
[[self window] _dirtyKeyViewLoop];
|
||||
@@ -537,14 +543,12 @@ var CPViewFlags = { },
|
||||
}
|
||||
else
|
||||
{
|
||||
var superview = aSubview._superview;
|
||||
|
||||
lastWindow = [superview window];
|
||||
|
||||
// Remove the view from its previous superview.
|
||||
[aSubview removeFromSuperview];
|
||||
|
||||
// Set the subview's window to our own.
|
||||
[aSubview _setWindow:_window];
|
||||
|
||||
// Notify the subview that it will be moving.
|
||||
[aSubview viewWillMoveToSuperview:self];
|
||||
[aSubview _removeFromSuperview];
|
||||
|
||||
// Set ourselves as the superview.
|
||||
aSubview._superview = self;
|
||||
@@ -577,6 +581,15 @@ var CPViewFlags = { },
|
||||
if (![aSubview isHidden] && [self isHiddenOrHasHiddenAncestor])
|
||||
[aSubview _notifyViewDidHide];
|
||||
|
||||
[aSubview viewDidMoveToSuperview];
|
||||
|
||||
// Set the subview's window to our own.
|
||||
if (_window)
|
||||
[aSubview _setWindow:_window];
|
||||
|
||||
if (!_window && lastWindow)
|
||||
[aSubview _setWindow:nil];
|
||||
|
||||
// This method might be called before we are fully unarchived, in which case the theme state isn't set up yet
|
||||
// and none of the below matters anyhow.
|
||||
if (_themeState)
|
||||
@@ -592,8 +605,6 @@ var CPViewFlags = { },
|
||||
[aSubview _notifyWindowDidResignKey];
|
||||
}
|
||||
|
||||
[aSubview viewDidMoveToSuperview];
|
||||
|
||||
[self didAddSubview:aSubview];
|
||||
}
|
||||
|
||||
@@ -610,6 +621,18 @@ var CPViewFlags = { },
|
||||
Does nothing if there's no container view.
|
||||
*/
|
||||
- (void)removeFromSuperview
|
||||
{
|
||||
var superview = _superview;
|
||||
|
||||
[self viewWillMoveToSuperview:nil];
|
||||
[self _removeFromSuperview];
|
||||
[self viewDidMoveToSuperview];
|
||||
|
||||
if (superview)
|
||||
[self _setWindow:nil];
|
||||
}
|
||||
|
||||
- (void)_removeFromSuperview
|
||||
{
|
||||
if (!_superview)
|
||||
return;
|
||||
@@ -634,8 +657,6 @@ var CPViewFlags = { },
|
||||
[self _notifyViewDidResignFirstResponder];
|
||||
|
||||
_superview = nil;
|
||||
|
||||
[self _setWindow:nil];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -645,14 +666,14 @@ var CPViewFlags = { },
|
||||
*/
|
||||
- (void)replaceSubview:(CPView)aSubview with:(CPView)aView
|
||||
{
|
||||
if (aSubview._superview !== self)
|
||||
if (aSubview._superview !== self || aSubview === aView)
|
||||
return;
|
||||
|
||||
var index = [_subviews indexOfObjectIdenticalTo:aSubview];
|
||||
|
||||
[aSubview removeFromSuperview];
|
||||
|
||||
[self _insertSubview:aView atIndex:index];
|
||||
|
||||
[aSubview removeFromSuperview];
|
||||
}
|
||||
|
||||
- (void)setSubviews:(CPArray)newSubviews
|
||||
@@ -727,13 +748,10 @@ var CPViewFlags = { },
|
||||
/* @ignore */
|
||||
- (void)_setWindow:(CPWindow)aWindow
|
||||
{
|
||||
if (_window === aWindow)
|
||||
return;
|
||||
|
||||
[[self window] _dirtyKeyViewLoop];
|
||||
|
||||
// Clear out first responder if we're the first responder and leaving.
|
||||
if ([_window firstResponder] === self)
|
||||
if ([_window firstResponder] === self && _window != aWindow)
|
||||
[_window makeFirstResponder:nil];
|
||||
|
||||
// Notify the view and its subviews
|
||||
@@ -803,6 +821,10 @@ var CPViewFlags = { },
|
||||
*/
|
||||
- (void)viewWillMoveToSuperview:(CPView)aView
|
||||
{
|
||||
[self _removeObservers];
|
||||
|
||||
if (aView)
|
||||
[self _addObservers];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -821,6 +843,32 @@ var CPViewFlags = { },
|
||||
{
|
||||
}
|
||||
|
||||
- (void)_removeObservers
|
||||
{
|
||||
if (!_isObserving)
|
||||
return;
|
||||
|
||||
var count = [_subviews count];
|
||||
|
||||
while (count--)
|
||||
[_subviews[count] _removeObservers];
|
||||
|
||||
_isObserving = NO;
|
||||
}
|
||||
|
||||
- (void)_addObservers
|
||||
{
|
||||
if (_isObserving)
|
||||
return;
|
||||
|
||||
var count = [_subviews count];
|
||||
|
||||
while (count--)
|
||||
[_subviews[count] _addObservers];
|
||||
|
||||
_isObserving = YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the menu item containing the receiver or one of its ancestor views.
|
||||
@return a menu item, or \c nil if the view or one of its ancestors wasn't found
|
||||
@@ -1024,7 +1072,8 @@ var CPViewFlags = { },
|
||||
else
|
||||
{
|
||||
var images = [[_backgroundColor patternImage] imageSlices],
|
||||
partIndex = 0;
|
||||
partIndex = 0,
|
||||
frameSize = aSize;
|
||||
|
||||
if (_backgroundType === BackgroundVerticalThreePartImage)
|
||||
{
|
||||
@@ -1034,16 +1083,21 @@ var CPViewFlags = { },
|
||||
// Make sure to repeat the top and bottom pieces horizontally if they're not the exact width needed.
|
||||
if (top)
|
||||
{
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width + "px", top + "px");
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], size.width, top);
|
||||
partIndex++;
|
||||
}
|
||||
if (_DOMImageSizes[1])
|
||||
{
|
||||
var height = frameSize.height - top - bottom;
|
||||
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width + "px", height + "px");
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], size.width, size.height - top - bottom);
|
||||
partIndex++;
|
||||
}
|
||||
if (bottom)
|
||||
{
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width + "px", bottom + "px");
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], size.width, bottom);
|
||||
}
|
||||
}
|
||||
@@ -1055,16 +1109,21 @@ var CPViewFlags = { },
|
||||
// Make sure to repeat the left and right pieces vertically if they're not the exact height needed.
|
||||
if (left)
|
||||
{
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], left + "px", frameSize.height + "px");
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], left, size.height);
|
||||
partIndex++;
|
||||
}
|
||||
if (_DOMImageSizes[1])
|
||||
{
|
||||
var width = (frameSize.width - left - right);
|
||||
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], width + "px", frameSize.height + "px");
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], size.width - left - right, size.height);
|
||||
partIndex++;
|
||||
}
|
||||
if (right)
|
||||
{
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], right + "px", frameSize.height + "px");
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], right, size.height);
|
||||
}
|
||||
}
|
||||
@@ -1805,6 +1864,9 @@ var CPViewFlags = { },
|
||||
_DOMElement.style.background = "";
|
||||
_DOMImageParts[0].style.background = [_backgroundColor cssString];
|
||||
|
||||
if (patternImage)
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[0], [patternImage size].width + "px", [patternImage size].height + "px");
|
||||
|
||||
if (CPFeatureIsCompatible(CPOpacityRequiresFilterFeature))
|
||||
_DOMImageParts[0].style.filter = "alpha(opacity=" + [_backgroundColor alphaComponent] * 100 + ")";
|
||||
else
|
||||
@@ -1815,6 +1877,9 @@ var CPViewFlags = { },
|
||||
}
|
||||
else
|
||||
_DOMElement.style.background = colorCSS;
|
||||
|
||||
if (patternImage)
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMElement, [patternImage size].width + "px", [patternImage size].height + "px");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1919,18 +1984,24 @@ var CPViewFlags = { },
|
||||
// Make sure to repeat the top and bottom pieces horizontally if they're not the exact width needed.
|
||||
if (top)
|
||||
{
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width + "px", top + "px");
|
||||
CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], frameSize.width, top);
|
||||
partIndex++;
|
||||
}
|
||||
if (_DOMImageSizes[1])
|
||||
{
|
||||
var height = frameSize.height - top - bottom;
|
||||
|
||||
//_DOMImageParts[partIndex].style.backgroundSize = frameSize.width + "px " + height + "px";
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width + "px", height + "px");
|
||||
CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, 0.0, top);
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], frameSize.width, frameSize.height - top - bottom);
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], frameSize.width, height);
|
||||
partIndex++;
|
||||
}
|
||||
if (bottom)
|
||||
{
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width + "px", bottom + "px");
|
||||
CPDOMDisplayServerSetStyleLeftBottom(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], frameSize.width, bottom);
|
||||
}
|
||||
@@ -1945,18 +2016,23 @@ var CPViewFlags = { },
|
||||
// Make sure to repeat the left and right pieces vertically if they're not the exact height needed.
|
||||
if (left)
|
||||
{
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], left + "px", frameSize.height + "px");
|
||||
CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], left, frameSize.height);
|
||||
partIndex++;
|
||||
}
|
||||
if (_DOMImageSizes[1])
|
||||
{
|
||||
var width = (frameSize.width - left - right);
|
||||
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], width + "px", frameSize.height + "px");
|
||||
CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, left, 0.0);
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], frameSize.width - left - right, frameSize.height);
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], width, frameSize.height);
|
||||
partIndex++;
|
||||
}
|
||||
if (right)
|
||||
{
|
||||
CPDomDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], right + "px", frameSize.height + "px");
|
||||
CPDOMDisplayServerSetStyleRightTop(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
|
||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], right, frameSize.height);
|
||||
}
|
||||
@@ -2541,7 +2617,7 @@ setBoundsOrigin:
|
||||
/*!
|
||||
Scrolls the nearest ancestor CPClipView a minimum amount so \c aRect can become visible.
|
||||
@param aRect the area to become visible
|
||||
@return <codeYES if any scrolling occurred, \c NO otherwise.
|
||||
@return \c YES if any scrolling occurred, \c NO otherwise.
|
||||
*/
|
||||
- (BOOL)scrollRectToVisible:(CGRect)aRect
|
||||
{
|
||||
@@ -2936,10 +3012,10 @@ setBoundsOrigin:
|
||||
|
||||
- (BOOL)unsetThemeState:(ThemeState)aState
|
||||
{
|
||||
if (aState && aState.isa && [aState isKindOfClass:CPArray])
|
||||
if (aState && aState.isa && [aState isKindOfClass:CPArray])
|
||||
aState = CPThemeState.apply(null, aState);
|
||||
|
||||
var oldThemeState = _themeState
|
||||
var oldThemeState = _themeState;
|
||||
_themeState = _themeState.without(aState);
|
||||
|
||||
if (oldThemeState === _themeState)
|
||||
|
||||
@@ -210,6 +210,7 @@ var CPViewControllerCachedCibs;
|
||||
[cibOwner viewControllerDidLoadCib:self];
|
||||
|
||||
_isLoading = NO;
|
||||
_isLazy = NO;
|
||||
[self _viewDidLoad];
|
||||
}
|
||||
else if (_isLazy)
|
||||
|
||||
+52
-10
@@ -901,6 +901,8 @@ CPTexturedBackgroundWindowMask
|
||||
|
||||
- (void)_orderFront
|
||||
{
|
||||
[[self contentView] _addObservers];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
// -dw- if a sheet is clicked, the parent window should come up too
|
||||
if (_isSheet)
|
||||
@@ -960,6 +962,8 @@ CPTexturedBackgroundWindowMask
|
||||
if (!_isVisible)
|
||||
return;
|
||||
|
||||
[[self contentView] _removeObservers];
|
||||
|
||||
if ([self isSheet])
|
||||
{
|
||||
// -dw- as in Cocoa, orderOut: detaches the sheet and animates out
|
||||
@@ -977,6 +981,7 @@ CPTexturedBackgroundWindowMask
|
||||
[_platformWindow order:CPWindowOut window:self relativeTo:nil];
|
||||
#endif
|
||||
|
||||
[self makeFirstResponder:nil];
|
||||
[self _updateMainAndKeyWindows];
|
||||
}
|
||||
|
||||
@@ -1841,6 +1846,12 @@ CPTexturedBackgroundWindowMask
|
||||
if (_leftMouseDownView !== _firstResponder && [_leftMouseDownView acceptsFirstResponder])
|
||||
[self makeFirstResponder:_leftMouseDownView];
|
||||
|
||||
var keyWindow = [CPApp keyWindow];
|
||||
|
||||
// This is only when we move from a platform to another one
|
||||
if ([keyWindow platformWindow] != [self platformWindow])
|
||||
[self makeKeyAndOrderFront:self];
|
||||
|
||||
[CPApp activateIgnoringOtherApps:YES];
|
||||
|
||||
var theWindow = [anEvent window],
|
||||
@@ -2472,7 +2483,7 @@ CPTexturedBackgroundWindowMask
|
||||
if (currentWindow === self || currentWindow === menuWindow)
|
||||
continue;
|
||||
|
||||
if ([currentWindow isVisible] && [currentWindow canBecomeKeyWindow])
|
||||
if ([currentWindow isVisible] && [currentWindow canBecomeKeyWindow] && [currentWindow platformWindow] == [keyWindow platformWindow])
|
||||
{
|
||||
[currentWindow makeKeyWindow];
|
||||
break;
|
||||
@@ -2674,6 +2685,23 @@ CPTexturedBackgroundWindowMask
|
||||
[attachedSheet setFrame:sheetFrame display:YES animate:NO];
|
||||
}
|
||||
|
||||
- (void)_previousSheetIsClosedNotification:(CPNotification)aNotification
|
||||
{
|
||||
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPWindowDidEndSheetNotification object:self];
|
||||
|
||||
var sheet = _sheetContext[@"nextSheet"],
|
||||
modalDelegate =_sheetContext[@"nextModalDelegate"],
|
||||
endSelector = _sheetContext[@"nextEndSelector"],
|
||||
contextInfo = _sheetContext[@"nextContextInfo"];
|
||||
|
||||
// Needed, because when the notification CPWindowDidEndSheetNotification is sent, the sheetContext is not up to date...
|
||||
setTimeout(function()
|
||||
{
|
||||
[sheet._windowView _enableSheet:YES inWindow:self];
|
||||
[self _attachSheet:sheet modalDelegate:modalDelegate didEndSelector:endSelector contextInfo:contextInfo];
|
||||
}, 0)
|
||||
}
|
||||
|
||||
/*
|
||||
Starting point for sheet session, called from CPApplication beginSheet:
|
||||
*/
|
||||
@@ -2682,9 +2710,24 @@ CPTexturedBackgroundWindowMask
|
||||
{
|
||||
if (_sheetContext)
|
||||
{
|
||||
[CPException raise:CPInternalInconsistencyException
|
||||
reason:@"The target window of beginSheet: already has a sheet, did you forget orderOut: ?"];
|
||||
return;
|
||||
// Here we wait till the current sheet is closed
|
||||
if (_sheetContext[@"isClosing"])
|
||||
{
|
||||
// Here we save the next sheet to open
|
||||
_sheetContext[@"nextSheet"] = aSheet;
|
||||
_sheetContext[@"nextModalDelegate"] = aModalDelegate;
|
||||
_sheetContext[@"nextEndSelector"] = didEndSelector;
|
||||
_sheetContext[@"nextContextInfo"] = contextInfo;
|
||||
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_previousSheetIsClosedNotification:) name:CPWindowDidEndSheetNotification object:self];
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
[CPException raise:CPInternalInconsistencyException
|
||||
reason:@"The target window of beginSheet: already has a sheet, did you forget orderOut: ?"];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_sheetContext = {
|
||||
@@ -2736,7 +2779,12 @@ CPTexturedBackgroundWindowMask
|
||||
*/
|
||||
- (void)_detachSheetWindow
|
||||
{
|
||||
if (_sheetContext["isClosing"])
|
||||
return;
|
||||
|
||||
_sheetContext["isAttached"] = NO;
|
||||
_sheetContext["isClosing"] = YES;
|
||||
_sheetContext["opened"] = NO;
|
||||
|
||||
// A timer seems to be necessary for the animation to work correctly.
|
||||
// It would be ideal to block here and spin the event loop, until attach is complete.
|
||||
@@ -2869,12 +2917,6 @@ CPTexturedBackgroundWindowMask
|
||||
return;
|
||||
}
|
||||
|
||||
if (_sheetContext["isClosing"])
|
||||
return;
|
||||
|
||||
_sheetContext["opened"] = NO;
|
||||
_sheetContext["isClosing"] = YES;
|
||||
|
||||
// The parent window can be orderedOut to disable the sheet animate out, as in Cocoa
|
||||
if ([self isVisible])
|
||||
{
|
||||
|
||||
@@ -80,6 +80,9 @@ aDOMElement.style.bottom = ROUND(____p.y) + "px";
|
||||
aDOMElement.width = MAX(0.0, ROUND(aWidth));\
|
||||
aDOMElement.height = MAX(0.0, ROUND(aHeight));
|
||||
|
||||
#define CPDomDisplayServerSetStyleBackgroundSize(aDOMElement, aWidth, aHeight)\
|
||||
aDOMElement.style.backgroundSize = aWidth + ' ' + aHeight;
|
||||
|
||||
#define CPDOMDisplayServerAppendChild(aParentElement, aChildElement) aParentElement.appendChild(aChildElement)
|
||||
|
||||
#define CPDOMDisplayServerInsertBefore(aParentElement, aChildElement, aBeforeElement) aParentElement.insertBefore(aChildElement, aBeforeElement)
|
||||
@@ -126,6 +129,9 @@ aDOMElement.style.bottom = ROUND(____p.y) + "px";
|
||||
CPDOMDisplayServerInstructions[__index + 2] = aWidth;\
|
||||
CPDOMDisplayServerInstructions[__index + 3] = aHeight;
|
||||
|
||||
#define CPDomDisplayServerSetStyleBackgroundSize(aDOMElement, aWidth, aHeight)\
|
||||
aDOMElement.style.backgroundSize = aWidth + ' ' + aHeight;
|
||||
|
||||
#define CPDOMDisplayServerAppendChild(aParentElement, aChildElement)\
|
||||
if (aChildElement.CPDOMDisplayContext) aChildElement.CPDOMDisplayContext[SetStyleOrigin] = -1;\
|
||||
CPDOMDisplayServerInstructions[CPDOMDisplayServerInstructionCount++] = AppendChild;\
|
||||
|
||||
@@ -151,7 +151,7 @@ var DOMFixedWidthSpanElement = nil,
|
||||
else if (CPFeatureIsCompatible(CPJavaScriptTextContentFeature))
|
||||
span.textContent = aString;
|
||||
|
||||
return CGSizeMake(span.clientWidth, span.clientHeight);
|
||||
return CGSizeMake(span.clientWidth + 1, span.clientHeight);
|
||||
}
|
||||
|
||||
+ (CPDictionary)metricsOfFont:(CPFont)aFont
|
||||
|
||||
@@ -1143,7 +1143,7 @@ var PreventScroll = true;
|
||||
|
||||
_mouseDownIsRightClick = button == 2 || (CPBrowserIsOperatingSystem(CPMacOperatingSystem) && button == 0 && modifierFlags & CPControlKeyMask);
|
||||
|
||||
if (sourceElement.tagName === "INPUT" && sourceElement != _DOMFocusElement)
|
||||
if ((sourceElement.tagName === "INPUT" || sourceElement.tagName === "TEXTAREA") && sourceElement != _DOMFocusElement)
|
||||
{
|
||||
if ([CPPlatform supportsDragAndDrop])
|
||||
{
|
||||
@@ -1280,7 +1280,7 @@ var PreventScroll = true;
|
||||
insertionIndex = _windowLevels[middle] > aLevel ? middle : middle + 1
|
||||
|
||||
[_windowLevels insertObject:aLevel atIndex:insertionIndex];
|
||||
layer._DOMElement.style.zIndex = aLevel;
|
||||
layer._DOMElement.style.zIndex = aLevel + 1; // adding one avoids negative zIndices. These have been causing issues in Chrome
|
||||
|
||||
_DOMBodyElement.appendChild(layer._DOMElement);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -419,6 +419,25 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
smallBezelColor = PatternColor(
|
||||
"{style}button-bezel{state}{position}.png",
|
||||
{
|
||||
styles: ["", "default"],
|
||||
states: ["", "highlighted", "disabled"],
|
||||
width: 3.0,
|
||||
height: 20.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
miniBezelColor = PatternColor(
|
||||
"{style}button-bezel{state}{position}.png",
|
||||
{
|
||||
styles: ["", "default"],
|
||||
states: ["", "highlighted", "disabled"],
|
||||
width: 3.0,
|
||||
height: 16.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
defaultBezelColor = PatternColor(
|
||||
[
|
||||
["default-button-bezel-left.png", 4.0, 24.0],
|
||||
@@ -505,13 +524,61 @@ var themedButtonValues = nil,
|
||||
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0], [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"text-shadow-offset", CGSizeMake(0.0, 1.0), CPThemeStateBordered],
|
||||
[@"line-break-mode", CPLineBreakByTruncatingTail],
|
||||
[@"bezel-color", bezelColor, CPThemeStateBordered],
|
||||
[@"bezel-color", highlightedBezelColor, [CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
[@"bezel-color", disabledBezelColor, [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color", defaultBezelColor, [CPThemeStateBordered, CPThemeStateDefault]],
|
||||
[@"bezel-color", defaultHighlightedBezelColor, [CPThemeStateBordered, CPThemeStateHighlighted, CPThemeStateDefault]],
|
||||
[@"bezel-color", defaultDisabledBezelColor, [CPThemeStateBordered, CPThemeStateDefault, CPThemeStateDisabled]],
|
||||
[@"content-inset", CGInsetMake(0.0, 7.0, 0.0, 7.0), CPThemeStateBordered],
|
||||
[@"bezel-color", bezelColor, CPThemeStateBordered],
|
||||
[@"bezel-color", highlightedBezelColor, [CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
[@"bezel-color", disabledBezelColor, [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color", defaultBezelColor, [CPThemeStateBordered, CPThemeStateDefault]],
|
||||
[@"bezel-color", defaultHighlightedBezelColor, [CPThemeStateBordered, CPThemeStateHighlighted, CPThemeStateDefault]],
|
||||
[@"bezel-color", defaultDisabledBezelColor, [CPThemeStateBordered, CPThemeStateDefault, CPThemeStateDisabled]],
|
||||
|
||||
[@"content-inset", CGInsetMake(0.0, 7.0, 0.0, 7.0), CPThemeStateBordered],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(2.0, 2.0, 0.0, 0.0), CPThemeStateBordered],
|
||||
|
||||
// RoundRect CPThemeStateControlSizeSmall
|
||||
[@"bezel-color",
|
||||
smallBezelColor["@"]["@"],
|
||||
[CPThemeStateControlSizeSmall, CPThemeStateBordered]],
|
||||
[@"bezel-color",
|
||||
smallBezelColor["@"]["highlighted"],
|
||||
[CPThemeStateControlSizeSmall, CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
[@"bezel-color",
|
||||
smallBezelColor["@"]["disabled"],
|
||||
[CPThemeStateControlSizeSmall, CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color",
|
||||
smallBezelColor["default"]["@"],
|
||||
[CPThemeStateControlSizeSmall, CPThemeStateBordered, CPThemeStateDefault]],
|
||||
[@"bezel-color",
|
||||
smallBezelColor["default"]["highlighted"],
|
||||
[CPThemeStateControlSizeSmall, CPThemeStateBordered, CPThemeStateHighlighted, CPThemeStateDefault]],
|
||||
[@"bezel-color",
|
||||
smallBezelColor["default"]["disabled"],
|
||||
[CPThemeStateControlSizeSmall, CPThemeStateBordered, CPThemeStateDefault, CPThemeStateDisabled]],
|
||||
|
||||
[@"content-inset", CGInsetMake(0.0, 5.0, 0.0, 5.0), [CPThemeStateControlSizeSmall, CPThemeStateBordered]],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(-3.0, 5.0, 0.0, 0.0), [CPThemeStateControlSizeSmall, CPThemeStateBordered]],
|
||||
|
||||
// RoundRect CPThemeStateControlSizeMini
|
||||
[@"bezel-color",
|
||||
miniBezelColor["@"]["@"],
|
||||
[CPThemeStateControlSizeMini, CPThemeStateBordered]],
|
||||
[@"bezel-color",
|
||||
miniBezelColor["@"]["highlighted"],
|
||||
[CPThemeStateControlSizeMini, CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
[@"bezel-color",
|
||||
miniBezelColor["@"]["disabled"],
|
||||
[CPThemeStateControlSizeMini, CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color",
|
||||
miniBezelColor["default"]["@"],
|
||||
[CPThemeStateControlSizeMini, CPThemeStateBordered, CPThemeStateDefault]],
|
||||
[@"bezel-color",
|
||||
miniBezelColor["default"]["highlighted"],
|
||||
[CPThemeStateControlSizeMini, CPThemeStateBordered, CPThemeStateHighlighted, CPThemeStateDefault]],
|
||||
[@"bezel-color",
|
||||
miniBezelColor["default"]["disabled"],
|
||||
[CPThemeStateControlSizeMini, CPThemeStateBordered, CPThemeStateDefault, CPThemeStateDisabled]],
|
||||
|
||||
[@"content-inset", CGInsetMake(0.0, 2.0, 2.0, 2.0), [CPThemeStateControlSizeMini, CPThemeStateBordered]],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(0.0, 13.0, 0.0, 0.0), [CPThemeStateControlSizeMini, CPThemeStateBordered]],
|
||||
|
||||
[@"bezel-color", roundedBezelColor, [CPThemeStateBordered, CPButtonStateBezelStyleRounded]],
|
||||
[@"bezel-color", roundedHighlightedBezelColor, [CPThemeStateBordered, CPThemeStateHighlighted, CPButtonStateBezelStyleRounded]],
|
||||
@@ -528,6 +595,10 @@ var themedButtonValues = nil,
|
||||
|
||||
[@"min-size", CGSizeMake(0.0, 24.0)],
|
||||
[@"max-size", CGSizeMake(-1.0, 24.0)],
|
||||
[@"min-size", CGSizeMake(0.0, 20.0), CPThemeStateControlSizeSmall],
|
||||
[@"max-size", CGSizeMake(-1.0, 20.0), CPThemeStateControlSizeSmall],
|
||||
[@"min-size", CGSizeMake(0.0, 16.0), CPThemeStateControlSizeMini],
|
||||
[@"max-size", CGSizeMake(-1.0, 16.0), CPThemeStateControlSizeMini],
|
||||
|
||||
[@"image-offset", CPButtonImageOffset]
|
||||
];
|
||||
@@ -569,7 +640,7 @@ var themedButtonValues = nil,
|
||||
+ (CPPopUpButton)themedPopUpButton
|
||||
{
|
||||
var button = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 24.0) pullsDown:NO],
|
||||
color = PatternColor(
|
||||
regularColor = PatternColor(
|
||||
[
|
||||
["popup-bezel-left.png", 3.0, 24.0],
|
||||
["popup-bezel-center.png", 1.0, 24.0],
|
||||
@@ -577,7 +648,7 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
disabledColor = PatternColor(
|
||||
regularDisabledColor = PatternColor(
|
||||
[
|
||||
["popup-bezel-disabled-left.png", 3.0, 24.0],
|
||||
["popup-bezel-disabled-center.png", 1.0, 24.0],
|
||||
@@ -585,21 +656,64 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
smallColor = PatternColor(
|
||||
"popup-bezel{state}{position}.png",
|
||||
{
|
||||
states: ["", "disabled"],
|
||||
width: 3.0,
|
||||
height: 20.0,
|
||||
rightWidth: 19.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
miniColor = PatternColor(
|
||||
"popup-bezel{state}{position}.png",
|
||||
{
|
||||
states: ["", "disabled"],
|
||||
width: 3.0,
|
||||
height: 16.0,
|
||||
rightWidth: 15.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
themeValues =
|
||||
[
|
||||
[@"bezel-color", color, CPThemeStateBordered],
|
||||
[@"bezel-color", disabledColor, [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color", regularColor, CPThemeStateBordered],
|
||||
[@"bezel-color", regularDisabledColor, [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
|
||||
[@"content-inset", CGInsetMake(0, 21.0 + 5.0, 0, 5.0), CPThemeStateBordered],
|
||||
[@"font", [CPFont boldSystemFontOfSize:CPFontCurrentSystemSize]],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0]],
|
||||
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0]],
|
||||
[@"content-inset", CGInsetMake(0, 22.0 + 5.0, 0, 5.0), CPThemeStateBordered],
|
||||
[@"font", [CPFont boldSystemFontOfSize:CPFontCurrentSystemSize]],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0]],
|
||||
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0]],
|
||||
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:0.6 alpha:1.0], [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:0.6], [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:0.6 alpha:1.0], [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:0.6], [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
|
||||
[@"min-size", CGSizeMake(32.0, 24.0)],
|
||||
[@"max-size", CGSizeMake(-1.0, 24.0)]
|
||||
[@"min-size", CGSizeMake(32.0, 24.0)],
|
||||
[@"max-size", CGSizeMake(-1.0, 24.0)],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(2.0, 0.0, -5.0, 0.0)],
|
||||
|
||||
// CPThemeStateControlSizeSmall
|
||||
[@"bezel-color", smallColor["@"], [CPThemeStateControlSizeSmall, CPThemeStateBordered]],
|
||||
[@"bezel-color", smallColor["disabled"], [CPThemeStateControlSizeSmall, CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
|
||||
[@"content-inset", CGInsetMake(0, 17.0 + 4.0, 0, 4.0), [CPThemeStateControlSizeSmall, CPThemeStateBordered]],
|
||||
[@"font", [CPFont boldSystemFontOfSize:11.0]],
|
||||
|
||||
[@"min-size", CGSizeMake(32.0, 20.0), CPThemeStateControlSizeSmall],
|
||||
[@"max-size", CGSizeMake(-1.0, 20.0), CPThemeStateControlSizeSmall],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(3.0, 3.0, -6.0, 0.0), CPThemeStateControlSizeSmall],
|
||||
|
||||
// CPThemeStateControlSizeMini
|
||||
[@"bezel-color", miniColor["@"], [CPThemeStateControlSizeMini, CPThemeStateBordered]],
|
||||
[@"bezel-color", miniColor["disabled"], [CPThemeStateControlSizeMini, CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
|
||||
[@"content-inset", CGInsetMake(0, 15.0 + 4.0, 2.0, 4.0), [CPThemeStateControlSizeMini, CPThemeStateBordered]],
|
||||
[@"font", [CPFont boldSystemFontOfSize:9.0]],
|
||||
|
||||
[@"min-size", CGSizeMake(32.0, 16.0), CPThemeStateControlSizeMini],
|
||||
[@"max-size", CGSizeMake(-1.0, 16.0), CPThemeStateControlSizeMini],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(1.0, 9.0, -3.0, 0.0), CPThemeStateControlSizeMini],
|
||||
];
|
||||
|
||||
[self registerThemeValues:themeValues forView:button];
|
||||
@@ -1001,7 +1115,26 @@ var themedButtonValues = nil,
|
||||
[@"text-shadow-color", [CPColor whiteColor], [CPThemeStateTableDataView, CPThemeStateGroupRow]],
|
||||
[@"text-shadow-offset", CGSizeMake(0,1), [CPThemeStateTableDataView, CPThemeStateGroupRow]],
|
||||
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:0.0 alpha:0.6], [CPThemeStateTableDataView, CPThemeStateGroupRow, CPThemeStateSelectedDataView]],
|
||||
[@"font", [CPFont boldSystemFontOfSize:CPFontCurrentSystemSize], [CPThemeStateTableDataView, CPThemeStateGroupRow]]
|
||||
[@"font", [CPFont boldSystemFontOfSize:CPFontCurrentSystemSize], [CPThemeStateTableDataView, CPThemeStateGroupRow]],
|
||||
|
||||
[@"min-size", CGSizeMake(-1.0, 29.0)],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(2.0, 0.0, -4.0, 0.0)],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(-3.0, -3.0, 6.0, 0.0), CPThemeStateBezeled],
|
||||
|
||||
// CPThemeStateControlSizeSmall
|
||||
[@"content-inset", CGInsetMake(7.0, 7.0, 5.0, 8.0), [CPThemeStateControlSizeSmall, CPThemeStateBezeled]],
|
||||
[@"content-inset", CGInsetMake(7.0, 7.0, 5.0, 8.0), [CPThemeStateControlSizeSmall, CPThemeStateBezeled, CPThemeStateEditing]],
|
||||
|
||||
[@"min-size", CGSizeMake(-1.0, 25.0), CPThemeStateControlSizeSmall],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(2.0, 0.0, -4.0, 0.0), CPThemeStateControlSizeSmall],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(-3.0, 4.0, 6.0, 7.0), [CPThemeStateControlSizeSmall, CPThemeStateBezeled]],
|
||||
|
||||
// CPThemeStateControlSizeMini
|
||||
[@"content-inset", CGInsetMake(6.0, 7.0, 5.0, 7.0), [CPThemeStateControlSizeMini, CPThemeStateBezeled]],
|
||||
[@"content-inset", CGInsetMake(6.0, 7.0, 5.0, 7.0), [CPThemeStateControlSizeMini, CPThemeStateBezeled, CPThemeStateEditing]],
|
||||
[@"min-size", CGSizeMake(-1.0, 22.0), CPThemeStateControlSizeMini],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(2.0, 0.0, -4.0, 0.0), CPThemeStateControlSizeMini],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(-3.0, 4.0, 6.0, 7.0), [CPThemeStateControlSizeMini, CPThemeStateBezeled]],
|
||||
];
|
||||
|
||||
[self registerThemeValues:themedTextFieldValues forView:textfield];
|
||||
@@ -1134,23 +1267,21 @@ var themedButtonValues = nil,
|
||||
|
||||
themeValues =
|
||||
[
|
||||
[@"bezel-color", bezelColor, CPThemeStateBezeled],
|
||||
[@"bezel-color", bezelDisabledColor, [CPThemeStateBezeled, CPThemeStateDisabled]],
|
||||
[@"bezel-color", bezelColor, CPThemeStateBezeled],
|
||||
[@"bezel-color", bezelDisabledColor, [CPThemeStateBezeled, CPThemeStateDisabled]],
|
||||
|
||||
[@"font", [CPFont boldSystemFontOfSize:13.0]],
|
||||
[@"text-color", [CPColor colorWithWhite:0.2 alpha:0.8]],
|
||||
[@"text-color", textDisabledColor, CPThemeStateDisabled],
|
||||
[@"text-color", textDisabledColor, CPThemeStateDisabled],
|
||||
|
||||
[@"content-inset", CGInsetMake(6.0, 0.0, 0.0, 3.0), CPThemeStateNormal],
|
||||
[@"content-inset", CGInsetMake(6.0, 0.0, 0.0, 5.0), CPThemeStateBezeled],
|
||||
[@"bezel-inset", CGInsetMake(0.0, -3.0, 0.0, -3.0), CPThemeStateBezeled],
|
||||
[@"content-inset", CGInsetMake(6.0, 0.0, 0.0, 3.0), CPThemeStateNormal],
|
||||
[@"content-inset", CGInsetMake(6.0, 0.0, 0.0, 5.0), CPThemeStateBezeled],
|
||||
|
||||
[@"datepicker-textfield-bezel-color", [CPColor clearColor], CPThemeStateNormal],
|
||||
[@"datepicker-textfield-bezel-color", bezelColorDatePickerTextField, CPThemeStateSelected],
|
||||
[@"datepicker-textfield-bezel-color", [CPColor clearColor], [CPThemeStateNormal, CPThemeStateDisabled]],
|
||||
[@"datepicker-textfield-bezel-color", bezelColorDatePickerTextField, [CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"bezel-inset", CGInsetMake(0.0, -3.0, 0.0, -3.0), CPThemeStateBezeled],
|
||||
|
||||
[@"min-size-datepicker-textfield", CGSizeMake(6.0, 18.0)],
|
||||
[@"datepicker-textfield-bezel-color", [CPColor clearColor], CPThemeStateNormal],
|
||||
[@"datepicker-textfield-bezel-color", bezelColorDatePickerTextField, CPThemeStateSelected],
|
||||
[@"datepicker-textfield-bezel-color", [CPColor clearColor], [CPThemeStateNormal, CPThemeStateDisabled]],
|
||||
[@"datepicker-textfield-bezel-color", bezelColorDatePickerTextField, [CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
|
||||
[@"separator-content-inset", CGInsetMake(0.0, -2.0, 0.0, -1.0)],
|
||||
|
||||
@@ -1159,11 +1290,37 @@ var themedButtonValues = nil,
|
||||
[@"content-inset-datepicker-textfield", CGInsetMake(2.0, 2.0, 0.0, 1.0), CPThemeStateSelected],
|
||||
[@"content-inset-datepicker-textfield-separator", CGInsetMake(2.0, 0.0, 0.0, 0.0), CPThemeStateSelected],
|
||||
|
||||
[@"date-hour-margin", 7.0],
|
||||
[@"stepper-margin", 2.0],
|
||||
[@"min-size-datepicker-textfield", CGSizeMake(6.0, 18.0)],
|
||||
[@"date-hour-margin", 7.0],
|
||||
[@"stepper-margin", 2.0],
|
||||
|
||||
[@"min-size", CGSizeMake(0.0, 29.0)],
|
||||
[@"max-size", CGSizeMake(-1.0, 29.0)]
|
||||
[@"min-size", CGSizeMake(0, 29.0)],
|
||||
[@"max-size", CGSizeMake(-1.0, 29.0)],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(0.0, 4.0, -3.0, 0.0)],
|
||||
|
||||
// CPThemeStateControlSizeSmall
|
||||
[@"content-inset", CGInsetMake(5.0, 0.0, 0.0, 5.0), [CPThemeStateControlSizeSmall, CPThemeStateNormal]],
|
||||
[@"content-inset", CGInsetMake(5.0, 0.0, 0.0, 5.0), [CPThemeStateControlSizeSmall, CPThemeStateBezeled]],
|
||||
|
||||
[@"min-size-datepicker-textfield", CGSizeMake(6.0, 16.0), CPThemeStateControlSizeSmall],
|
||||
[@"date-hour-margin", 5.0, CPThemeStateControlSizeSmall],
|
||||
[@"stepper-margin", 3.0, CPThemeStateControlSizeSmall],
|
||||
|
||||
[@"min-size", CGSizeMake(0, 26.0), CPThemeStateControlSizeSmall],
|
||||
[@"max-size", CGSizeMake(-1.0, 26.0), CPThemeStateControlSizeSmall],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(1.0, 6.0, -3.0, 0.0), CPThemeStateControlSizeSmall],
|
||||
|
||||
// CPThemeStateControlSizeMini
|
||||
[@"content-inset", CGInsetMake(4.0, 0.0, 0.0, 4.0), [CPThemeStateControlSizeMini, CPThemeStateNormal]],
|
||||
[@"content-inset", CGInsetMake(4.0, 0.0, 0.0, 4.0), [CPThemeStateControlSizeMini, CPThemeStateBezeled]],
|
||||
|
||||
[@"min-size-datepicker-textfield", CGSizeMake(6.0, 12.0), CPThemeStateControlSizeMini],
|
||||
[@"date-hour-margin", 2.0, CPThemeStateControlSizeMini],
|
||||
[@"stepper-margin", 2.0, CPThemeStateControlSizeMini],
|
||||
|
||||
[@"min-size", CGSizeMake(0, 22.0), CPThemeStateControlSizeMini],
|
||||
[@"max-size", CGSizeMake(-1.0, 22.0), CPThemeStateControlSizeMini],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(0.0, 9.0, -3.0, 0.0), CPThemeStateControlSizeMini]
|
||||
];
|
||||
|
||||
[datePicker setDatePickerStyle:CPTextFieldDatePickerStyle];
|
||||
@@ -1523,7 +1680,7 @@ var themedButtonValues = nil,
|
||||
{
|
||||
var combo = [[CPComboBox alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 29.0)],
|
||||
|
||||
bezelColor = PatternColor(
|
||||
regularBezelColor = PatternColor(
|
||||
[
|
||||
["combobox-bezel-left.png", 6.0, 29.0],
|
||||
["combobox-bezel-center.png", 1.0, 29.0],
|
||||
@@ -1531,7 +1688,7 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
bezelFocusedColor = PatternColor(
|
||||
regularBezelFocusedColor = PatternColor(
|
||||
[
|
||||
["combobox-bezel-focused-left.png", 6.0, 29.0],
|
||||
["combobox-bezel-focused-center.png", 1.0, 29.0],
|
||||
@@ -1539,7 +1696,7 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
bezelDisabledColor = PatternColor(
|
||||
regularBezelDisabledColor = PatternColor(
|
||||
[
|
||||
["combobox-bezel-disabled-left.png", 6.0, 29.0],
|
||||
["combobox-bezel-disabled-center.png", 1.0, 29.0],
|
||||
@@ -1547,7 +1704,7 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
bezelNoBorderColor = PatternColor(
|
||||
regularBezelNoBorderColor = PatternColor(
|
||||
[
|
||||
["combobox-bezel-no-border-left.png", 6.0, 29.0],
|
||||
["combobox-bezel-no-border-center.png", 1.0, 29.0],
|
||||
@@ -1555,7 +1712,7 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
bezelNoBorderFocusedColor = PatternColor(
|
||||
regularBezelNoBorderFocusedColor = PatternColor(
|
||||
[
|
||||
["combobox-bezel-no-border-focused-left.png", 6.0, 29.0],
|
||||
["combobox-bezel-no-border-focused-center.png", 1.0, 29.0],
|
||||
@@ -1563,7 +1720,7 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
bezelNoBorderDisabledColor = PatternColor(
|
||||
regularBezelNoBorderDisabledColor = PatternColor(
|
||||
[
|
||||
["combobox-bezel-no-border-disabled-left.png", 6.0, 29.0],
|
||||
["combobox-bezel-no-border-disabled-center.png", 1.0, 29.0],
|
||||
@@ -1571,31 +1728,134 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
smallBezelColor = PatternColor(
|
||||
"combobox-bezel{state}{position}.png",
|
||||
{
|
||||
states: ["", "disabled"],
|
||||
width: 4.0,
|
||||
height: 20.0,
|
||||
rightWidth: 19.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
smallBezelFocusedColor = PatternColor(
|
||||
"combobox-bezel-focused{position}.png",
|
||||
{
|
||||
width: 8.0,
|
||||
height: 26.0,
|
||||
rightWidth: 23.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
smallBezelNoBorderColor = PatternColor(
|
||||
"combobox-bezel-no-border{state}{position}.png",
|
||||
{
|
||||
states: ["", "disabled"],
|
||||
width: 4.0,
|
||||
height: 20.0,
|
||||
rightWidth: 19.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
smallBezelNoBorderFocusedColor = PatternColor(
|
||||
"combobox-bezel-no-border-focused{position}.png",
|
||||
{
|
||||
width: 8.0,
|
||||
height: 26.0,
|
||||
rightWidth: 23.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
miniBezelColor = PatternColor(
|
||||
"combobox-bezel{state}{position}.png",
|
||||
{
|
||||
states: ["", "disabled"],
|
||||
width: 4.0,
|
||||
height: 17.5,
|
||||
rightWidth: 17.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
miniBezelFocusedColor = PatternColor(
|
||||
"combobox-bezel-focused{position}.png",
|
||||
{
|
||||
width: 6.0,
|
||||
height: 22.0,
|
||||
rightWidth: 19.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
miniBezelNoBorderColor = PatternColor(
|
||||
"combobox-bezel-no-border{state}{position}.png",
|
||||
{
|
||||
states: ["", "disabled"],
|
||||
width: 4.0,
|
||||
height: 17.5,
|
||||
rightWidth: 17.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
miniBezelNoBorderFocusedColor = PatternColor(
|
||||
"combobox-bezel-no-border-focused{position}.png",
|
||||
{
|
||||
width: 6.0,
|
||||
height: 22.0,
|
||||
rightWidth: 19.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
overrides =
|
||||
[
|
||||
[@"bezel-color", bezelColor, [CPThemeStateBezeled, CPComboBoxStateButtonBordered]],
|
||||
[@"bezel-color", bezelFocusedColor, [CPThemeStateBezeled, CPComboBoxStateButtonBordered, CPThemeStateEditing]],
|
||||
[@"bezel-color", bezelDisabledColor, [CPThemeStateBezeled, CPComboBoxStateButtonBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color", regularBezelColor, [CPThemeStateBezeled, CPComboBoxStateButtonBordered]],
|
||||
[@"bezel-color", regularBezelFocusedColor, [CPThemeStateBezeled, CPComboBoxStateButtonBordered, CPThemeStateEditing]],
|
||||
[@"bezel-color", regularBezelDisabledColor, [CPThemeStateBezeled, CPComboBoxStateButtonBordered, CPThemeStateDisabled]],
|
||||
|
||||
[@"bezel-color", bezelNoBorderColor, CPThemeStateBezeled],
|
||||
[@"bezel-color", bezelNoBorderFocusedColor, [CPThemeStateBezeled, CPThemeStateEditing]],
|
||||
[@"bezel-color", bezelNoBorderDisabledColor, [CPThemeStateBezeled, CPThemeStateDisabled]],
|
||||
[@"bezel-color", regularBezelNoBorderColor, CPThemeStateBezeled],
|
||||
[@"bezel-color", regularBezelNoBorderFocusedColor, [CPThemeStateBezeled, CPThemeStateEditing]],
|
||||
[@"bezel-color", regularBezelNoBorderDisabledColor, [CPThemeStateBezeled, CPThemeStateDisabled]],
|
||||
|
||||
[@"border-inset", CGInsetMake(3.0, 3.0, 3.0, 3.0), CPThemeStateBezeled],
|
||||
[@"border-inset", CGInsetMake(3.0, 3.0, 3.0, 3.0), CPThemeStateBezeled],
|
||||
|
||||
[@"bezel-inset", CGInsetMake(0.0, 1.0, 1.0, 1.0), [CPThemeStateBezeled, CPThemeStateEditing]],
|
||||
[@"bezel-inset", CGInsetMake(0.0, 1.0, 1.0, 1.0), [CPThemeStateBezeled, CPThemeStateEditing]],
|
||||
|
||||
// The right border inset has to make room for the focus ring and popup button
|
||||
[@"content-inset", CGInsetMake(8.0, 27.0, 7.0, 8.0), [CPThemeStateBezeled, CPComboBoxStateButtonBordered]],
|
||||
[@"content-inset", CGInsetMake(8.0, 24.0, 7.0, 8.0), CPThemeStateBezeled],
|
||||
[@"content-inset", CGInsetMake(8.0, 24.0, 7.0, 8.0), [CPThemeStateBezeled, CPThemeStateEditing]],
|
||||
[@"content-inset", CGInsetMake(8.0, 27.0, 7.0, 8.0), [CPThemeStateBezeled, CPComboBoxStateButtonBordered]],
|
||||
[@"content-inset", CGInsetMake(8.0, 27.0, 7.0, 8.0), CPThemeStateBezeled],
|
||||
[@"content-inset", CGInsetMake(8.0, 27.0, 7.0, 8.0), [CPThemeStateBezeled, CPThemeStateEditing]],
|
||||
|
||||
[@"popup-button-size", CGSizeMake(21.0, 23.0), [CPThemeStateBezeled, CPComboBoxStateButtonBordered]],
|
||||
[@"popup-button-size", CGSizeMake(17.0, 23.0), CPThemeStateBezeled],
|
||||
[@"popup-button-size", CGSizeMake(21.0, 23.0), [CPThemeStateBezeled, CPComboBoxStateButtonBordered]],
|
||||
[@"popup-button-size", CGSizeMake(17.0, 23.0), CPThemeStateBezeled],
|
||||
|
||||
// Because combo box uses a three-part bezel, the height is fixed
|
||||
[@"min-size", CGSizeMake(0, 29.0)],
|
||||
[@"max-size", CGSizeMake(-1, 29.0)]
|
||||
[@"min-size", CGSizeMake(0, 29.0)],
|
||||
[@"max-size", CGSizeMake(-1, 29.0)],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(-3.0, 0.0, 3.0, 0.0)],
|
||||
|
||||
// CPThemeStateControlSizeSmall
|
||||
[@"bezel-color", smallBezelColor["@"], [CPThemeStateControlSizeSmall, CPThemeStateBezeled, CPComboBoxStateButtonBordered]],
|
||||
[@"bezel-color", smallBezelFocusedColor, [CPThemeStateControlSizeSmall, CPThemeStateBezeled, CPComboBoxStateButtonBordered, CPThemeStateEditing]],
|
||||
[@"bezel-color", smallBezelColor["disabled"], [CPThemeStateControlSizeSmall, CPThemeStateBezeled, CPComboBoxStateButtonBordered, CPThemeStateDisabled]],
|
||||
|
||||
[@"bezel-color", smallBezelNoBorderColor["@"], [CPThemeStateControlSizeSmall, CPThemeStateBezeled]],
|
||||
[@"bezel-color", smallBezelNoBorderFocusedColor, [CPThemeStateControlSizeSmall, CPThemeStateBezeled, CPThemeStateEditing]],
|
||||
[@"bezel-color", smallBezelNoBorderColor["disabled"], [CPThemeStateControlSizeSmall, CPThemeStateBezeled, CPThemeStateDisabled]],
|
||||
|
||||
[@"min-size", CGSizeMake(0, 26.0), CPThemeStateControlSizeSmall],
|
||||
[@"max-size", CGSizeMake(-1, 26.0), CPThemeStateControlSizeSmall],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(-2.0, -1.0, 1.0, 0.0), CPThemeStateControlSizeSmall],
|
||||
|
||||
// CPThemeStateControlSizeMini
|
||||
[@"bezel-color", miniBezelColor["@"], [CPThemeStateControlSizeMini, CPThemeStateBezeled, CPComboBoxStateButtonBordered]],
|
||||
[@"bezel-color", miniBezelFocusedColor, [CPThemeStateControlSizeMini, CPThemeStateBezeled, CPComboBoxStateButtonBordered, CPThemeStateEditing]],
|
||||
[@"bezel-color", miniBezelColor["disabled"], [CPThemeStateControlSizeMini, CPThemeStateBezeled, CPComboBoxStateButtonBordered, CPThemeStateDisabled]],
|
||||
|
||||
[@"bezel-color", miniBezelNoBorderColor["@"], [CPThemeStateControlSizeMini, CPThemeStateBezeled]],
|
||||
[@"bezel-color", miniBezelNoBorderFocusedColor, [CPThemeStateControlSizeMini, CPThemeStateBezeled, CPThemeStateEditing]],
|
||||
[@"bezel-color", miniBezelNoBorderColor["disabled"], [CPThemeStateControlSizeMini, CPThemeStateBezeled, CPThemeStateDisabled]],
|
||||
|
||||
[@"min-size", CGSizeMake(0, 22.0), CPThemeStateControlSizeMini],
|
||||
[@"max-size", CGSizeMake(-1, 22.0), CPThemeStateControlSizeMini],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(-2.0, -1.0, 2.0, 0.0), CPThemeStateControlSizeMini],
|
||||
];
|
||||
|
||||
[self registerThemeValues:overrides forView:combo inherit:themedTextFieldValues];
|
||||
@@ -1607,31 +1867,70 @@ var themedButtonValues = nil,
|
||||
{
|
||||
var button = [CPRadio radioWithTitle:@"Hello Friend!"],
|
||||
|
||||
imageNormal = PatternImage("radio-image.png", 17.0, 17.0),
|
||||
imageSelected = PatternImage("radio-image-selected.png", 17.0, 17.0),
|
||||
imageSelectedHighlighted = PatternImage("radio-image-selected-highlighted.png", 17.0, 17.0),
|
||||
imageSelectedDisabled = PatternImage("radio-image-selected-disabled.png", 17.0, 17.0),
|
||||
imageDisabled = PatternImage("radio-image-disabled.png", 17.0, 17.0),
|
||||
imageHighlighted = PatternImage("radio-image-highlighted.png", 17.0, 17.0),
|
||||
regularImageNormal = PatternImage("radio-image.png", 17.0, 17.0),
|
||||
regularImageSelected = PatternImage("radio-image-selected.png", 17.0, 17.0),
|
||||
regularImageSelectedHighlighted = PatternImage("radio-image-selected-highlighted.png", 17.0, 17.0),
|
||||
regularImageSelectedDisabled = PatternImage("radio-image-selected-disabled.png", 17.0, 17.0),
|
||||
regularImageDisabled = PatternImage("radio-image-disabled.png", 17.0, 17.0),
|
||||
regularImageHighlighted = PatternImage("radio-image-highlighted.png", 17.0, 17.0),
|
||||
|
||||
smallImageNormal = PatternImage("radio-image.png", 15.0, 15.0),
|
||||
smallImageSelected = PatternImage("radio-image-selected.png", 15.0, 15.0),
|
||||
smallImageSelectedHighlighted = PatternImage("radio-image-selected-highlighted.png", 15.0, 15.0),
|
||||
smallImageSelectedDisabled = PatternImage("radio-image-selected.png", 15.0, 15.0),
|
||||
smallImageDisabled = PatternImage("radio-image.png", 15.0, 15.0),
|
||||
smallImageHighlighted = PatternImage("radio-image-highlighted.png", 15.0, 15.0),
|
||||
|
||||
miniImageNormal = PatternImage("radio-image.png", 14.0, 14.0),
|
||||
miniImageSelected = PatternImage("radio-image-selected.png", 14.0, 14.0),
|
||||
miniImageSelectedHighlighted = PatternImage("radio-image-selected-highlighted.png", 14.0, 14.0),
|
||||
miniImageSelectedDisabled = PatternImage("radio-image-selected.png", 14.0, 14.0),
|
||||
miniImageDisabled = PatternImage("radio-image.png", 14.0, 14.0),
|
||||
miniImageHighlighted = PatternImage("radio-image-highlighted.png", 14.0, 14.0);
|
||||
|
||||
themeValues =
|
||||
[
|
||||
[@"alignment", CPLeftTextAlignment, CPThemeStateNormal],
|
||||
[@"content-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateNormal],
|
||||
[@"alignment", CPLeftTextAlignment, CPThemeStateNormal],
|
||||
[@"content-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateNormal],
|
||||
|
||||
[@"image", imageNormal, CPThemeStateNormal],
|
||||
[@"image", imageSelected, CPThemeStateSelected],
|
||||
[@"image", imageSelectedHighlighted, [CPThemeStateSelected, CPThemeStateHighlighted]],
|
||||
[@"image", imageHighlighted, CPThemeStateHighlighted],
|
||||
[@"image", imageDisabled, CPThemeStateDisabled],
|
||||
[@"image", imageSelectedDisabled, [CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"image-offset", CPRadioImageOffset],
|
||||
[@"image", regularImageNormal, CPThemeStateNormal],
|
||||
[@"image", regularImageSelected, CPThemeStateSelected],
|
||||
[@"image", regularImageSelectedHighlighted, [CPThemeStateSelected, CPThemeStateHighlighted]],
|
||||
[@"image", regularImageHighlighted, CPThemeStateHighlighted],
|
||||
[@"image", regularImageDisabled, CPThemeStateDisabled],
|
||||
[@"image", regularImageSelectedDisabled, [CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"image-offset", CPRadioImageOffset],
|
||||
|
||||
[@"font", [CPFont systemFontOfSize:CPFontCurrentSystemSize], CPThemeStateNormal],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0], CPThemeStateDisabled],
|
||||
[@"font", [CPFont systemFontOfSize:CPFontCurrentSystemSize], CPThemeStateNormal],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0], CPThemeStateDisabled],
|
||||
|
||||
[@"min-size", CGSizeMake(0.0, 17.0)],
|
||||
[@"max-size", CGSizeMake(-1.0, -1.0)]
|
||||
[@"min-size", CGSizeMake(0.0, 17.0)],
|
||||
[@"max-size", CGSizeMake(-1.0, -1.0)],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(0.0, -2.0, 0.0, 0.0)],
|
||||
|
||||
// CPThemeStateControlSizeSmall
|
||||
[@"image", smallImageNormal, [CPThemeStateControlSizeSmall, CPThemeStateNormal]],
|
||||
[@"image", smallImageSelected, [CPThemeStateControlSizeSmall, CPThemeStateSelected]],
|
||||
[@"image", smallImageSelectedHighlighted, [CPThemeStateControlSizeSmall, CPThemeStateSelected, CPThemeStateHighlighted]],
|
||||
[@"image", smallImageHighlighted, [CPThemeStateControlSizeSmall, CPThemeStateHighlighted]],
|
||||
[@"image", smallImageDisabled, [CPThemeStateControlSizeSmall, CPThemeStateDisabled]],
|
||||
[@"image", smallImageSelectedDisabled, [CPThemeStateControlSizeSmall, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
|
||||
[@"min-size", CGSizeMake(0, 15.0), CPThemeStateControlSizeSmall],
|
||||
[@"max-size", CGSizeMake(-1, 15.0), CPThemeStateControlSizeSmall],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(2.0, -3.0, 0.0, 0.0), CPThemeStateControlSizeSmall],
|
||||
|
||||
// CPThemeStateControlSizeMini
|
||||
[@"image", miniImageNormal, [CPThemeStateControlSizeMini, CPThemeStateNormal]],
|
||||
[@"image", miniImageSelected, [CPThemeStateControlSizeMini, CPThemeStateSelected]],
|
||||
[@"image", miniImageSelectedHighlighted, [CPThemeStateControlSizeMini, CPThemeStateSelected, CPThemeStateHighlighted]],
|
||||
[@"image", miniImageHighlighted, [CPThemeStateControlSizeMini, CPThemeStateHighlighted]],
|
||||
[@"image", miniImageDisabled, [CPThemeStateControlSizeMini, CPThemeStateDisabled]],
|
||||
[@"image", miniImageSelectedDisabled, [CPThemeStateControlSizeMini, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
|
||||
[@"min-size", CGSizeMake(0, 14.0), CPThemeStateControlSizeMini],
|
||||
[@"max-size", CGSizeMake(-1, 14.0), CPThemeStateControlSizeMini],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(4.0, -3.0, 0.0, 0.0), CPThemeStateControlSizeMini],
|
||||
];
|
||||
|
||||
[self registerThemeValues:themeValues forView:button];
|
||||
@@ -1643,31 +1942,70 @@ var themedButtonValues = nil,
|
||||
{
|
||||
var button = [CPCheckBox checkBoxWithTitle:@"Another Option"],
|
||||
|
||||
imageNormal = PatternImage("check-box-image.png", 15.0, 16.0),
|
||||
imageSelected = PatternImage("check-box-image-selected.png", 15.0, 16.0),
|
||||
imageSelectedHighlighted = PatternImage("check-box-image-selected-highlighted.png", 15.0, 16.0),
|
||||
imageSelectedDisabled = PatternImage("check-box-image-selected-disabled.png", 15.0, 16.0),
|
||||
imageDisabled = PatternImage("check-box-image-disabled.png", 15.0, 16.0),
|
||||
imageHighlighted = PatternImage("check-box-image-highlighted.png", 15.0, 16.0),
|
||||
regularImageNormal = PatternImage("check-box-image.png", 15.0, 16.0),
|
||||
regularImageSelected = PatternImage("check-box-image-selected.png", 15.0, 16.0),
|
||||
regularImageSelectedHighlighted = PatternImage("check-box-image-selected-highlighted.png", 15.0, 16.0),
|
||||
regularImageSelectedDisabled = PatternImage("check-box-image-selected-disabled.png", 15.0, 16.0),
|
||||
regularImageDisabled = PatternImage("check-box-image-disabled.png", 15.0, 16.0),
|
||||
regularImageHighlighted = PatternImage("check-box-image-highlighted.png", 15.0, 16.0),
|
||||
|
||||
smallImageNormal = PatternImage("check-box-image.png", 15.0, 16.0),
|
||||
smallImageSelected = PatternImage("check-box-image-selected.png", 15.0, 16.0),
|
||||
smallImageSelectedHighlighted = PatternImage("check-box-image-selected-highlighted.png", 15.0, 16.0),
|
||||
smallImageSelectedDisabled = PatternImage("check-box-image-selected.png", 15.0, 16.0),
|
||||
smallImageDisabled = PatternImage("check-box-image.png", 15.0, 16.0),
|
||||
smallImageHighlighted = PatternImage("check-box-image-highlighted.png", 15.0, 16.0),
|
||||
|
||||
miniImageNormal = PatternImage("check-box-image.png", 13.0, 14.0),
|
||||
miniImageSelected = PatternImage("check-box-image-selected.png", 13.0, 14.0),
|
||||
miniImageSelectedHighlighted = PatternImage("check-box-image-selected-highlighted.png", 13.0, 14.0),
|
||||
miniImageSelectedDisabled = PatternImage("check-box-image-selected.png", 13.0, 14.0),
|
||||
miniImageDisabled = PatternImage("check-box-image.png", 13.0, 14.0),
|
||||
miniImageHighlighted = PatternImage("check-box-image-highlighted.png", 13.0, 14.0),
|
||||
|
||||
themeValues =
|
||||
[
|
||||
[@"alignment", CPLeftTextAlignment, CPThemeStateNormal],
|
||||
[@"content-inset", CGInsetMakeZero(), CPThemeStateNormal],
|
||||
[@"alignment", CPLeftTextAlignment, CPThemeStateNormal],
|
||||
[@"content-inset", CGInsetMakeZero(), CPThemeStateNormal],
|
||||
|
||||
[@"image", imageNormal, CPThemeStateNormal],
|
||||
[@"image", imageSelected, CPThemeStateSelected],
|
||||
[@"image", imageSelectedHighlighted, [CPThemeStateSelected, CPThemeStateHighlighted]],
|
||||
[@"image", imageHighlighted, CPThemeStateHighlighted],
|
||||
[@"image", imageDisabled, CPThemeStateDisabled],
|
||||
[@"image", imageSelectedDisabled, [CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"image-offset", CPCheckBoxImageOffset],
|
||||
[@"image", regularImageNormal, CPThemeStateNormal],
|
||||
[@"image", regularImageSelected, CPThemeStateSelected],
|
||||
[@"image", regularImageSelectedHighlighted, [CPThemeStateSelected, CPThemeStateHighlighted]],
|
||||
[@"image", regularImageHighlighted, CPThemeStateHighlighted],
|
||||
[@"image", regularImageDisabled, CPThemeStateDisabled],
|
||||
[@"image", regularImageSelectedDisabled, [CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"image-offset", CPCheckBoxImageOffset],
|
||||
|
||||
[@"font", [CPFont systemFontOfSize:CPFontCurrentSystemSize], CPThemeStateNormal],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0], CPThemeStateDisabled],
|
||||
[@"font", [CPFont systemFontOfSize:CPFontCurrentSystemSize], CPThemeStateNormal],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0], CPThemeStateDisabled],
|
||||
|
||||
[@"min-size", CGSizeMake(0.0, 17.0)],
|
||||
[@"max-size", CGSizeMake(-1.0, -1.0)]
|
||||
[@"min-size", CGSizeMake(0.0, 17.0)],
|
||||
[@"max-size", CGSizeMake(-1.0, -1.0)],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(3.0, 0.0, 0.0, 0.0)],
|
||||
|
||||
// CPThemeStateControlSizeSmall
|
||||
[@"image", smallImageNormal, [CPThemeStateControlSizeSmall, CPThemeStateNormal]],
|
||||
[@"image", smallImageSelected, [CPThemeStateControlSizeSmall, CPThemeStateSelected]],
|
||||
[@"image", smallImageSelectedHighlighted, [CPThemeStateControlSizeSmall, CPThemeStateSelected, CPThemeStateHighlighted]],
|
||||
[@"image", smallImageHighlighted, [CPThemeStateControlSizeSmall, CPThemeStateHighlighted]],
|
||||
[@"image", smallImageDisabled, [CPThemeStateControlSizeSmall, CPThemeStateDisabled]],
|
||||
[@"image", smallImageSelectedDisabled, [CPThemeStateControlSizeSmall, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
|
||||
[@"min-size", CGSizeMake(16.0, 16.0), CPThemeStateControlSizeSmall],
|
||||
[@"max-size", CGSizeMake(-1.0, -1.0), CPThemeStateControlSizeSmall],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(4.0, 0.0, 15.0, 0.0), CPThemeStateControlSizeSmall],
|
||||
|
||||
// CPThemeStateControlSizeMini
|
||||
[@"image", miniImageNormal, [CPThemeStateControlSizeMini, CPThemeStateNormal]],
|
||||
[@"image", miniImageSelected, [CPThemeStateControlSizeMini, CPThemeStateSelected]],
|
||||
[@"image", miniImageSelectedHighlighted, [CPThemeStateControlSizeMini, CPThemeStateSelected, CPThemeStateHighlighted]],
|
||||
[@"image", miniImageHighlighted, [CPThemeStateControlSizeMini, CPThemeStateHighlighted]],
|
||||
[@"image", miniImageDisabled, [CPThemeStateControlSizeMini, CPThemeStateDisabled]],
|
||||
[@"image", miniImageSelectedDisabled, [CPThemeStateControlSizeMini, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
|
||||
[@"min-size", CGSizeMake(13.0, 14.0), CPThemeStateControlSizeMini],
|
||||
[@"max-size", CGSizeMake(-1.0, -1.0), CPThemeStateControlSizeMini],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(5.0, 0.0, 15.0, 0.0), CPThemeStateControlSizeMini],
|
||||
];
|
||||
|
||||
[button setThemeState:CPThemeStateSelected];
|
||||
@@ -1751,6 +2089,52 @@ var themedButtonValues = nil,
|
||||
pushedHighlightedLeftBezelColor = PatternColor("segmented-control-bezel-pushed-highlighted-left.png", 4.0, 24.0),
|
||||
pushedHighlightedRightBezelColor = PatternColor("segmented-control-bezel-pushed-highlighted-right.png", 4.0, 24.0);
|
||||
|
||||
var smallCenterBezelColor = PatternColor("segmented-control-bezel-center.png", 1.0, 20.0),
|
||||
smallDividerBezelColor = PatternColor("segmented-control-bezel-divider.png", 1.0, 20.0),
|
||||
smallCenterHighlightedBezelColor = PatternColor("segmented-control-bezel-highlighted-center.png", 1.0, 20.0),
|
||||
smallDividerHighlightedBezelColor = PatternColor("segmented-control-bezel-highlighted-divider.png", 1.0, 20.0),
|
||||
smallLeftHighlightedBezelColor = PatternColor("segmented-control-bezel-highlighted-left.png", 4.0, 20.0),
|
||||
smallRightHighlightedBezelColor = PatternColor("segmented-control-bezel-highlighted-right.png", 4.0, 20.0),
|
||||
smallInactiveCenterBezelColor = PatternColor("segmented-control-bezel-disabled-center.png", 1.0, 20.0),
|
||||
smallInactiveDividerBezelColor = PatternColor("segmented-control-bezel-disabled-divider.png", 1.0, 20.0),
|
||||
smallInactiveLeftBezelColor = PatternColor("segmented-control-bezel-disabled-left.png", 4.0, 20.0),
|
||||
smallInactiveRightBezelColor = PatternColor("segmented-control-bezel-disabled-right.png", 4.0, 20.0),
|
||||
smallInactiveHighlightedCenterBezelColor = PatternColor("segmented-control-bezel-highlighted-disabled-center.png", 1.0, 20.0),
|
||||
smallInactiveHighlightedDividerBezelColor = PatternColor("segmented-control-bezel-highlighted-disabled-divider.png", 1.0, 20.0),
|
||||
smallInactiveHighlightedLeftBezelColor = PatternColor("segmented-control-bezel-highlighted-disabled-left.png", 4.0, 20.0),
|
||||
smallInactiveHighlightedRightBezelColor = PatternColor("segmented-control-bezel-highlighted-disabled-right.png", 4.0, 20.0),
|
||||
smallLeftBezelColor = PatternColor("segmented-control-bezel-left.png", 4.0, 20.0),
|
||||
smallRightBezelColor = PatternColor("segmented-control-bezel-right.png", 4.0, 20.0),
|
||||
smallPushedCenterBezelColor = PatternColor("segmented-control-bezel-pushed-center.png", 1.0, 20.0),
|
||||
smallPushedLeftBezelColor = PatternColor("segmented-control-bezel-pushed-left.png", 4.0, 20.0),
|
||||
smallPushedRightBezelColor = PatternColor("segmented-control-bezel-pushed-right.png", 4.0, 20.0),
|
||||
smallPushedHighlightedCenterBezelColor = PatternColor("segmented-control-bezel-pushed-highlighted-center.png", 1.0, 20.0),
|
||||
smallPushedHighlightedLeftBezelColor = PatternColor("segmented-control-bezel-pushed-highlighted-left.png", 4.0, 20.0),
|
||||
smallPushedHighlightedRightBezelColor = PatternColor("segmented-control-bezel-pushed-highlighted-right.png", 4.0, 20.0);
|
||||
|
||||
var miniCenterBezelColor = PatternColor("segmented-control-bezel-center.png", 1.0, 15.0),
|
||||
miniDividerBezelColor = PatternColor("segmented-control-bezel-divider.png", 1.0, 15.0),
|
||||
miniCenterHighlightedBezelColor = PatternColor("segmented-control-bezel-highlighted-center.png", 1.0, 15.0),
|
||||
miniDividerHighlightedBezelColor = PatternColor("segmented-control-bezel-highlighted-divider.png", 1.0, 15.0),
|
||||
miniLeftHighlightedBezelColor = PatternColor("segmented-control-bezel-highlighted-left.png", 4.0, 15.0),
|
||||
miniRightHighlightedBezelColor = PatternColor("segmented-control-bezel-highlighted-right.png", 4.0, 15.0),
|
||||
miniInactiveCenterBezelColor = PatternColor("segmented-control-bezel-disabled-center.png", 1.0, 15.0),
|
||||
miniInactiveDividerBezelColor = PatternColor("segmented-control-bezel-disabled-divider.png", 1.0, 15.0),
|
||||
miniInactiveLeftBezelColor = PatternColor("segmented-control-bezel-disabled-left.png", 4.0, 15.0),
|
||||
miniInactiveRightBezelColor = PatternColor("segmented-control-bezel-disabled-right.png", 4.0, 15.0),
|
||||
miniInactiveHighlightedCenterBezelColor = PatternColor("segmented-control-bezel-highlighted-disabled-center.png", 1.0, 15.0),
|
||||
miniInactiveHighlightedDividerBezelColor = PatternColor("segmented-control-bezel-highlighted-disabled-divider.png", 1.0, 15.0),
|
||||
miniInactiveHighlightedLeftBezelColor = PatternColor("segmented-control-bezel-highlighted-disabled-left.png", 4.0, 15.0),
|
||||
miniInactiveHighlightedRightBezelColor = PatternColor("segmented-control-bezel-highlighted-disabled-right.png", 4.0, 15.0),
|
||||
miniLeftBezelColor = PatternColor("segmented-control-bezel-left.png", 4.0, 15.0),
|
||||
miniRightBezelColor = PatternColor("segmented-control-bezel-right.png", 4.0, 15.0),
|
||||
miniPushedCenterBezelColor = PatternColor("segmented-control-bezel-pushed-center.png", 1.0, 15.0),
|
||||
miniPushedLeftBezelColor = PatternColor("segmented-control-bezel-pushed-left.png", 4.0, 15.0),
|
||||
miniPushedRightBezelColor = PatternColor("segmented-control-bezel-pushed-right.png", 4.0, 15.0),
|
||||
miniPushedHighlightedCenterBezelColor = PatternColor("segmented-control-bezel-pushed-highlighted-center.png", 1.0, 15.0),
|
||||
miniPushedHighlightedLeftBezelColor = PatternColor("segmented-control-bezel-pushed-highlighted-left.png", 4.0, 15.0),
|
||||
miniPushedHighlightedRightBezelColor = PatternColor("segmented-control-bezel-pushed-highlighted-right.png", 4.0, 15.0);
|
||||
|
||||
themedSegmentedControlValues =
|
||||
[
|
||||
[@"center-segment-bezel-color", centerBezelColor, CPThemeStateNormal],
|
||||
@@ -1779,9 +2163,75 @@ var themedButtonValues = nil,
|
||||
[@"right-segment-bezel-color", pushedRightBezelColor, CPThemeStateHighlighted],
|
||||
[@"right-segment-bezel-color", pushedHighlightedRightBezelColor, [CPThemeStateHighlighted, CPThemeStateSelected]],
|
||||
|
||||
|
||||
[@"center-segment-bezel-color", smallCenterBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateNormal]],
|
||||
[@"center-segment-bezel-color", smallInactiveCenterBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateDisabled]],
|
||||
[@"center-segment-bezel-color", smallInactiveHighlightedCenterBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"center-segment-bezel-color", smallCenterHighlightedBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateSelected]],
|
||||
[@"center-segment-bezel-color", smallPushedCenterBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateHighlighted]],
|
||||
[@"center-segment-bezel-color", smallPushedHighlightedCenterBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateHighlighted, CPThemeStateSelected]],
|
||||
|
||||
[@"divider-bezel-color", smallDividerBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateNormal]],
|
||||
[@"divider-bezel-color", smallInactiveDividerBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateDisabled]],
|
||||
[@"divider-bezel-color", smallInactiveHighlightedDividerBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"divider-bezel-color", smallDividerHighlightedBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateSelected]],
|
||||
|
||||
[@"left-segment-bezel-color", smallLeftBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateNormal]],
|
||||
[@"left-segment-bezel-color", smallInactiveLeftBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateDisabled]],
|
||||
[@"left-segment-bezel-color", smallInactiveHighlightedLeftBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"left-segment-bezel-color", smallLeftHighlightedBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateSelected]],
|
||||
[@"left-segment-bezel-color", smallPushedLeftBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateHighlighted]],
|
||||
[@"left-segment-bezel-color", smallPushedHighlightedLeftBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateHighlighted, CPThemeStateSelected]],
|
||||
|
||||
[@"right-segment-bezel-color", smallRightBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateNormal]],
|
||||
[@"right-segment-bezel-color", smallInactiveRightBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateDisabled]],
|
||||
[@"right-segment-bezel-color", smallInactiveHighlightedRightBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"right-segment-bezel-color", smallRightHighlightedBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateSelected]],
|
||||
[@"right-segment-bezel-color", smallPushedRightBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateHighlighted]],
|
||||
[@"right-segment-bezel-color", smallPushedHighlightedRightBezelColor, [CPThemeStateControlSizeSmall, CPThemeStateHighlighted, CPThemeStateSelected]],
|
||||
|
||||
|
||||
[@"center-segment-bezel-color", miniCenterBezelColor, [CPThemeStateControlSizeMini, CPThemeStateNormal]],
|
||||
[@"center-segment-bezel-color", miniInactiveCenterBezelColor, [CPThemeStateControlSizeMini, CPThemeStateDisabled]],
|
||||
[@"center-segment-bezel-color", miniInactiveHighlightedCenterBezelColor, [CPThemeStateControlSizeMini, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"center-segment-bezel-color", miniCenterHighlightedBezelColor, [CPThemeStateControlSizeMini, CPThemeStateSelected]],
|
||||
[@"center-segment-bezel-color", miniPushedCenterBezelColor, [CPThemeStateControlSizeMini, CPThemeStateHighlighted]],
|
||||
[@"center-segment-bezel-color", miniPushedHighlightedCenterBezelColor, [CPThemeStateControlSizeMini, CPThemeStateHighlighted, CPThemeStateSelected]],
|
||||
|
||||
[@"divider-bezel-color", miniDividerBezelColor, [CPThemeStateControlSizeMini, CPThemeStateNormal]],
|
||||
[@"divider-bezel-color", miniInactiveDividerBezelColor, [CPThemeStateControlSizeMini, CPThemeStateDisabled]],
|
||||
[@"divider-bezel-color", miniInactiveHighlightedDividerBezelColor, [CPThemeStateControlSizeMini, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"divider-bezel-color", miniDividerHighlightedBezelColor, [CPThemeStateControlSizeMini, CPThemeStateSelected]],
|
||||
|
||||
[@"left-segment-bezel-color", miniLeftBezelColor, [CPThemeStateControlSizeMini, CPThemeStateNormal]],
|
||||
[@"left-segment-bezel-color", miniInactiveLeftBezelColor, [CPThemeStateControlSizeMini, CPThemeStateDisabled]],
|
||||
[@"left-segment-bezel-color", miniInactiveHighlightedLeftBezelColor, [CPThemeStateControlSizeMini, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"left-segment-bezel-color", miniLeftHighlightedBezelColor, [CPThemeStateControlSizeMini, CPThemeStateSelected]],
|
||||
[@"left-segment-bezel-color", miniPushedLeftBezelColor, [CPThemeStateControlSizeMini, CPThemeStateHighlighted]],
|
||||
[@"left-segment-bezel-color", miniPushedHighlightedLeftBezelColor, [CPThemeStateControlSizeMini, CPThemeStateHighlighted, CPThemeStateSelected]],
|
||||
|
||||
[@"right-segment-bezel-color", miniRightBezelColor, [CPThemeStateControlSizeMini, CPThemeStateNormal]],
|
||||
[@"right-segment-bezel-color", miniInactiveRightBezelColor, [CPThemeStateControlSizeMini, CPThemeStateDisabled]],
|
||||
[@"right-segment-bezel-color", miniInactiveHighlightedRightBezelColor, [CPThemeStateControlSizeMini, CPThemeStateSelected, CPThemeStateDisabled]],
|
||||
[@"right-segment-bezel-color", miniRightHighlightedBezelColor, [CPThemeStateControlSizeMini, CPThemeStateSelected]],
|
||||
[@"right-segment-bezel-color", miniPushedRightBezelColor, [CPThemeStateControlSizeMini, CPThemeStateHighlighted]],
|
||||
[@"right-segment-bezel-color", miniPushedHighlightedRightBezelColor, [CPThemeStateControlSizeMini, CPThemeStateHighlighted, CPThemeStateSelected]],
|
||||
|
||||
[@"content-inset", CGInsetMake(0.0, 4.0, 0.0, 4.0), CPThemeStateNormal],
|
||||
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateNormal],
|
||||
|
||||
[@"min-size", CGSizeMake(-1.0, 24.0)],
|
||||
[@"max-size", CGSizeMake(-1.0, 24.0)],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(1.0, 1.0, -3.0, 0.0)],
|
||||
|
||||
[@"min-size", CGSizeMake(-1.0, 20.0), CPThemeStateControlSizeSmall],
|
||||
[@"max-size", CGSizeMake(-1.0, 20.0), CPThemeStateControlSizeSmall],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(2.0, 0.0, -4.0, 0.0), CPThemeStateControlSizeSmall],
|
||||
|
||||
[@"min-size", CGSizeMake(-1.0, 15.0), CPThemeStateControlSizeMini],
|
||||
[@"max-size", CGSizeMake(-1.0, 15.0), CPThemeStateControlSizeMini],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(1.0, 0.0, -2.0, 0.0), CPThemeStateControlSizeMini],
|
||||
|
||||
[@"font", [CPFont boldSystemFontOfSize:CPFontCurrentSystemSize]],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0]],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:0.6 alpha:1.0], CPThemeStateDisabled],
|
||||
@@ -1790,8 +2240,7 @@ var themedButtonValues = nil,
|
||||
[@"text-shadow-offset", CGSizeMake(0.0, 1.0)],
|
||||
[@"line-break-mode", CPLineBreakByTruncatingTail],
|
||||
|
||||
[@"divider-thickness", 1.0],
|
||||
[@"default-height", 25.0]
|
||||
[@"divider-thickness", 1.0]
|
||||
];
|
||||
|
||||
[self registerThemeValues:themedSegmentedControlValues forView:segmentedControl];
|
||||
@@ -2256,17 +2705,82 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
smallBezelUp = PatternColor(
|
||||
"stepper-bezel-big{state}-up{position}.png",
|
||||
{
|
||||
states: ["", "highlighted", "disabled"],
|
||||
width: 3.0,
|
||||
height: 11.0,
|
||||
centerWidth: 11.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
smallBezelDown = PatternColor(
|
||||
"stepper-bezel-big{state}-down{position}.png",
|
||||
{
|
||||
states: ["", "highlighted", "disabled"],
|
||||
width: 3.0,
|
||||
height: 10.0,
|
||||
centerWidth: 11.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
miniBezelUp = PatternColor(
|
||||
"stepper-bezel-big{state}-up{position}.png",
|
||||
{
|
||||
states: ["", "highlighted", "disabled"],
|
||||
width: 2.0,
|
||||
height: 8.0,
|
||||
centerWidth: 8.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
miniBezelDown = PatternColor(
|
||||
"stepper-bezel-big{state}-down{position}.png",
|
||||
{
|
||||
states: ["", "highlighted", "disabled"],
|
||||
width: 2.0,
|
||||
height: 7.0,
|
||||
centerWidth: 8.0,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
|
||||
themeValues =
|
||||
[
|
||||
[@"bezel-color-up-button", bezelUp, CPThemeStateBordered],
|
||||
[@"bezel-color-down-button", bezelDown, CPThemeStateBordered],
|
||||
[@"bezel-color-up-button", bezelUpDisabled, [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color-down-button", bezelDownDisabled, [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color-up-button", bezelUpHighlighted, [CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
[@"bezel-color-down-button", bezelDownHighlighted, [CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
[@"min-size", CGSizeMake(25.0, 25.0)],
|
||||
[@"bezel-color-up-button", bezelUp, CPThemeStateBordered],
|
||||
[@"bezel-color-down-button", bezelDown, CPThemeStateBordered],
|
||||
[@"bezel-color-up-button", bezelUpDisabled, [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color-down-button", bezelDownDisabled, [CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color-up-button", bezelUpHighlighted, [CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
[@"bezel-color-down-button", bezelDownHighlighted, [CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
[@"up-button-size", CGSizeMake(19.0, 13.0)],
|
||||
[@"down-button-size", CGSizeMake(19.0, 12.0)]
|
||||
[@"down-button-size", CGSizeMake(19.0, 12.0)],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(3.0, -25.0, 0.0, 0.0)],
|
||||
|
||||
// CPThemeStateControlSizeSmall
|
||||
[@"bezel-color-up-button", smallBezelUp["@"], [CPThemeStateControlSizeSmall, CPThemeStateBordered]],
|
||||
[@"bezel-color-down-button", smallBezelDown["@"], [CPThemeStateControlSizeSmall, CPThemeStateBordered]],
|
||||
[@"bezel-color-up-button", smallBezelUp["disabled"], [CPThemeStateControlSizeSmall, CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color-down-button", smallBezelDown["disabled"], [CPThemeStateControlSizeSmall, CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color-up-button", smallBezelUp["highlighted"], [CPThemeStateControlSizeSmall, CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
[@"bezel-color-down-button", smallBezelDown["highlighted"], [CPThemeStateControlSizeSmall, CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
|
||||
[@"up-button-size", CGSizeMake(17.0, 11.0), CPThemeStateControlSizeSmall],
|
||||
[@"down-button-size", CGSizeMake(17.0, 10.0), CPThemeStateControlSizeSmall],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(3.0, -21.0, 0.0, 0.0), CPThemeStateControlSizeSmall],
|
||||
|
||||
// CPThemeStateControlSizeMini
|
||||
[@"bezel-color-up-button", miniBezelUp["@"], [CPThemeStateControlSizeMini, CPThemeStateBordered]],
|
||||
[@"bezel-color-down-button", miniBezelDown["@"], [CPThemeStateControlSizeMini, CPThemeStateBordered]],
|
||||
[@"bezel-color-up-button", miniBezelUp["disabled"], [CPThemeStateControlSizeMini, CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color-down-button", miniBezelDown["disabled"], [CPThemeStateControlSizeMini, CPThemeStateBordered, CPThemeStateDisabled]],
|
||||
[@"bezel-color-up-button", miniBezelUp["highlighted"], [CPThemeStateControlSizeMini, CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
[@"bezel-color-down-button", miniBezelDown["highlighted"], [CPThemeStateControlSizeMini, CPThemeStateBordered, CPThemeStateHighlighted]],
|
||||
|
||||
[@"up-button-size", CGSizeMake(12.0, 8.0), CPThemeStateControlSizeMini],
|
||||
[@"down-button-size", CGSizeMake(12.0, 7.0), CPThemeStateControlSizeMini],
|
||||
[@"nib2cib-adjustment-frame", CGRectMake(3.0, -14.0, 0.0, 0.0), CPThemeStateControlSizeMini],
|
||||
];
|
||||
|
||||
[self registerThemeValues:themeValues forView:stepper];
|
||||
@@ -2296,7 +2810,8 @@ var themedButtonValues = nil,
|
||||
[@"slice-last-bottom-border-color", sliceLastBottomBorderColor],
|
||||
[@"font", [CPFont systemFontOfSize:10.0]],
|
||||
[@"add-image", addImage],
|
||||
[@"remove-image", removeImage]
|
||||
[@"remove-image", removeImage],
|
||||
[@"vertical-alignment", CPCenterVerticalTextAlignment]
|
||||
];
|
||||
|
||||
[self registerThemeValues:ruleEditorThemedValues forView:ruleEditor];
|
||||
@@ -2704,6 +3219,7 @@ var themedButtonValues = nil,
|
||||
}),
|
||||
|
||||
closeButtonImage = PatternImage(@"window-standard-close-button.png", 16, 16),
|
||||
closeButtonImageInactive = PatternImage(@"window-standard-close-button-inactive.png", 16, 16),
|
||||
closeButtonImageHighlighted = PatternImage(@"window-standard-button-highlighted.png",16, 16),
|
||||
unsavedButtonImage = PatternImage(@"window-standard-button-unsaved.png",16, 16),
|
||||
unsavedButtonImageHighlighted = PatternImage(@"window-standard-close-button-unsaved-highlighted.png",16, 16),
|
||||
@@ -2736,7 +3252,9 @@ var themedButtonValues = nil,
|
||||
|
||||
[@"unsaved-image-button" ,unsavedButtonImage],
|
||||
[@"unsaved-image-highlighted-button" ,unsavedButtonImageHighlighted],
|
||||
[@"close-image-button" ,closeButtonImage],
|
||||
[@"close-image-button" ,closeButtonImageInactive, CPThemeStateNormal],
|
||||
[@"close-image-button" ,closeButtonImage, CPThemeStateKeyWindow],
|
||||
[@"close-image-button" ,closeButtonImage, CPThemeStateMainWindow],
|
||||
[@"close-image-highlighted-button" ,closeButtonImageHighlighted],
|
||||
[@"minimize-image-button" ,minimizeButtonImage],
|
||||
[@"minimize-image-highlighted-button" ,minimizeButtonImageHighlighted],
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 88 B |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 79 B |
File diff suppressed because it is too large
Load Diff
@@ -229,7 +229,7 @@ var ListColumnIdentifier = @"1";
|
||||
|
||||
[self listWillPopUp];
|
||||
|
||||
[_panel orderFront:nil];
|
||||
[[aView window] addChildWindow:_panel ordered:CPWindowAbove];
|
||||
}
|
||||
|
||||
#pragma mark Setting Display Attributes
|
||||
|
||||
@@ -513,6 +513,9 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
|
||||
{
|
||||
// We are watching opacity, so this triggers the next transition
|
||||
#if PLATFORM(DOM)
|
||||
// We force the style to recalculate the values, this is needed to avoid a transition issue
|
||||
// More information here : https://code.google.com/p/chromium/issues/detail?id=388082
|
||||
[self _currentTransformMatrix];
|
||||
_DOMElement.style.opacity = 1;
|
||||
_DOMElement.style.height = frame.size.height + @"px";
|
||||
_DOMElement.style.width = frame.size.width + @"px";
|
||||
@@ -608,7 +611,7 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
|
||||
_DOMElement.removeEventListener(CPBrowserStyleProperty('transitionend'), _orderFrontTransitionFunction, YES);
|
||||
_DOMElement.removeEventListener(CPBrowserStyleProperty('transitionend'), _transitionCompleteFunction, YES);
|
||||
|
||||
var matrix = window.getComputedStyle(_DOMElement, null)[CPBrowserStyleProperty(@"transform")],
|
||||
var matrix = [self _currentTransformMatrix],
|
||||
currentScale = (matrix.split('(')[1]).split(',')[0];
|
||||
|
||||
[self setCSS3Property:@"Transform" value:@"scale(" + currentScale + ")"];
|
||||
@@ -652,6 +655,13 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
|
||||
#pragma mark -
|
||||
#pragma mark Private
|
||||
|
||||
- (CPString)_currentTransformMatrix
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
return window.getComputedStyle(_DOMElement, null)[CPBrowserStyleProperty(@"transform")];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (BOOL)_hasOnlyTransientChild:(_CPPopoverWindow)aWindow
|
||||
{
|
||||
var childWindows = [aWindow childWindows];
|
||||
@@ -710,24 +720,23 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
|
||||
break;
|
||||
}
|
||||
|
||||
[_delegate close];
|
||||
[_delegate performClose:self];
|
||||
break;
|
||||
|
||||
case CPPopoverBehaviorTransient:
|
||||
[_delegate close];
|
||||
break;
|
||||
|
||||
case CPPopoverBehaviorApplicationDefined:
|
||||
[self _trapNextMouseDown];
|
||||
[_delegate performClose:self];
|
||||
break;
|
||||
}
|
||||
|
||||
if ([self isVisible])
|
||||
[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];
|
||||
[CPApp setTarget:self selector:@selector(_mouseWasClicked:) forNextEventMatchingMask:CPLeftMouseDownMask | CPRightMouseDownMask untilDate:nil inMode:CPDefaultRunLoopMode dequeue:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -181,7 +181,6 @@ var _CPToolTipHeight = 24.0,
|
||||
_content = [CPTextField labelWithTitle:aString];
|
||||
[_content setFont:[CPFont systemFontOfSize:_CPToolTipFontSize]]
|
||||
[_content setLineBreakMode:CPLineBreakByCharWrapping];
|
||||
[_content setAlignment:CPJustifiedTextAlignment];
|
||||
[_content setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
[_content setFrameOrigin:CGPointMake(0.0, 0.0)];
|
||||
[_content setFrameSize:textFrameSize];
|
||||
|
||||
@@ -327,6 +327,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
||||
Class _nativeClass;
|
||||
CPDictionary _changesForKey;
|
||||
CPDictionary _nestingForKey;
|
||||
CPDictionary _minOptionsForKey;
|
||||
Object _observersForKey;
|
||||
int _observersForKeyLength;
|
||||
CPSet _replacedKeys;
|
||||
@@ -354,6 +355,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
||||
_observersForKey = {};
|
||||
_changesForKey = {};
|
||||
_nestingForKey = {};
|
||||
_minOptionsForKey = {};
|
||||
_observersForKeyLength = 0;
|
||||
|
||||
[self _replaceClass];
|
||||
@@ -767,12 +769,20 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
||||
|
||||
if (options & CPKeyValueObservingOptionInitial)
|
||||
{
|
||||
var newValue = [_targetObject valueForKeyPath:aPath];
|
||||
var changes;
|
||||
|
||||
if (newValue === nil || newValue === undefined)
|
||||
newValue = [CPNull null];
|
||||
if (options & CPKeyValueObservingOptionNew)
|
||||
{
|
||||
var newValue = [_targetObject valueForKeyPath:aPath];
|
||||
|
||||
if (newValue == nil)
|
||||
newValue = [CPNull null];
|
||||
|
||||
changes = @{ CPKeyValueChangeKindKey: CPKeyValueChangeSetting, CPKeyValueChangeNewKey: newValue };
|
||||
} else {
|
||||
changes = @{ CPKeyValueChangeKindKey: CPKeyValueChangeSetting };
|
||||
}
|
||||
|
||||
var changes = @{ CPKeyValueChangeNewKey: newValue };
|
||||
[anObserver observeValueForKeyPath:aPath ofObject:_targetObject change:changes context:aContext];
|
||||
}
|
||||
}
|
||||
@@ -819,7 +829,9 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
||||
|
||||
- (void)_sendNotificationsForKey:(CPString)aKey changeOptions:(CPDictionary)changeOptions isBefore:(BOOL)isBefore
|
||||
{
|
||||
var changes = _changesForKey[aKey];
|
||||
var changes = _changesForKey[aKey],
|
||||
observers = [_observersForKey[aKey] allValues],
|
||||
observersMinimumOptions = 0;
|
||||
|
||||
if (isBefore)
|
||||
{
|
||||
@@ -838,61 +850,78 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
||||
|
||||
_nestingForKey[aKey] = 1;
|
||||
|
||||
// Get the combined minimum of the ...Old and ...New options for all observers
|
||||
var count = observers ? observers.length : 0;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
var observerInfo = observers[count];
|
||||
|
||||
observersMinimumOptions |= observerInfo.options & kvoNewAndOld;
|
||||
}
|
||||
|
||||
_minOptionsForKey[aKey] = observersMinimumOptions;
|
||||
changes = changeOptions;
|
||||
|
||||
var indexes = [changes objectForKey:CPKeyValueChangeIndexesKey],
|
||||
setMutationKind = changes[_CPKeyValueChangeSetMutationKindKey];
|
||||
|
||||
if (setMutationKind)
|
||||
if (observersMinimumOptions & CPKeyValueObservingOptionOld)
|
||||
{
|
||||
var setMutationObjects = [changes[_CPKeyValueChangeSetMutationObjectsKey] copy],
|
||||
setExistingObjects = [[_targetObject valueForKey: aKey] copy];
|
||||
var indexes = [changes objectForKey:CPKeyValueChangeIndexesKey],
|
||||
setMutationKind = changes[_CPKeyValueChangeSetMutationKindKey];
|
||||
|
||||
if (setMutationKind == CPKeyValueMinusSetMutation)
|
||||
if (setMutationKind)
|
||||
{
|
||||
[setExistingObjects intersectSet: setMutationObjects];
|
||||
[changes setValue:setExistingObjects forKey:CPKeyValueChangeOldKey];
|
||||
var setMutationObjects = [changes[_CPKeyValueChangeSetMutationObjectsKey] copy],
|
||||
setExistingObjects = [[_targetObject valueForKey: aKey] copy];
|
||||
|
||||
if (setMutationKind == CPKeyValueMinusSetMutation)
|
||||
{
|
||||
[setExistingObjects intersectSet: setMutationObjects];
|
||||
[changes setValue:setExistingObjects forKey:CPKeyValueChangeOldKey];
|
||||
}
|
||||
else if (setMutationKind === CPKeyValueIntersectSetMutation || setMutationKind === CPKeyValueSetSetMutation)
|
||||
{
|
||||
[setExistingObjects minusSet: setMutationObjects];
|
||||
[changes setValue:setExistingObjects forKey:CPKeyValueChangeOldKey];
|
||||
}
|
||||
|
||||
//for unordered to-many relationships (CPSet) even new values can only be calculated before!!!
|
||||
if (setMutationKind === CPKeyValueUnionSetMutation || setMutationKind === CPKeyValueSetSetMutation)
|
||||
{
|
||||
[setMutationObjects minusSet: setExistingObjects];
|
||||
//hide new value (for CPKeyValueObservingOptionPrior messages)
|
||||
//as long as "didChangeValue..." is not yet called!
|
||||
changes[_CPKeyValueChangeSetMutationNewValueKey] = setMutationObjects;
|
||||
}
|
||||
}
|
||||
else if (setMutationKind === CPKeyValueIntersectSetMutation || setMutationKind === CPKeyValueSetSetMutation)
|
||||
else if (indexes)
|
||||
{
|
||||
[setExistingObjects minusSet: setMutationObjects];
|
||||
[changes setValue:setExistingObjects forKey:CPKeyValueChangeOldKey];
|
||||
var type = [changes objectForKey:CPKeyValueChangeKindKey];
|
||||
|
||||
// for ordered to-many relationships, oldvalue is only sensible for replace and remove
|
||||
if (type === CPKeyValueChangeReplacement || type === CPKeyValueChangeRemoval)
|
||||
{
|
||||
//FIXME: do we need to go through and replace "" with CPNull?
|
||||
var newValues = [[_targetObject mutableArrayValueForKeyPath:aKey] objectsAtIndexes:indexes];
|
||||
[changes setValue:newValues forKey:CPKeyValueChangeOldKey];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var oldValue = [_targetObject valueForKey:aKey];
|
||||
|
||||
if (oldValue === nil || oldValue === undefined)
|
||||
oldValue = [CPNull null];
|
||||
|
||||
[changes setObject:oldValue forKey:CPKeyValueChangeOldKey];
|
||||
}
|
||||
|
||||
//for unordered to-many relationships (CPSet) even new values can only be calculated before!!!
|
||||
if (setMutationKind === CPKeyValueUnionSetMutation || setMutationKind === CPKeyValueSetSetMutation)
|
||||
{
|
||||
[setMutationObjects minusSet: setExistingObjects];
|
||||
//hide new value (for CPKeyValueObservingOptionPrior messages)
|
||||
//as long as "didChangeValue..." is not yet called!
|
||||
changes[_CPKeyValueChangeSetMutationNewValueKey] = setMutationObjects;
|
||||
}
|
||||
}
|
||||
else if (indexes)
|
||||
{
|
||||
var type = [changes objectForKey:CPKeyValueChangeKindKey];
|
||||
|
||||
// for ordered to-many relationships, oldvalue is only sensible for replace and remove
|
||||
if (type === CPKeyValueChangeReplacement || type === CPKeyValueChangeRemoval)
|
||||
{
|
||||
//FIXME: do we need to go through and replace "" with CPNull?
|
||||
var newValues = [[_targetObject mutableArrayValueForKeyPath:aKey] objectsAtIndexes:indexes];
|
||||
[changes setValue:newValues forKey:CPKeyValueChangeOldKey];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var oldValue = [_targetObject valueForKey:aKey];
|
||||
|
||||
if (oldValue === nil || oldValue === undefined)
|
||||
oldValue = [CPNull null];
|
||||
|
||||
[changes setObject:oldValue forKey:CPKeyValueChangeOldKey];
|
||||
}
|
||||
|
||||
[changes setObject:1 forKey:CPKeyValueChangeNotificationIsPriorKey];
|
||||
|
||||
_changesForKey[aKey] = changes;
|
||||
|
||||
// Clear ...New option as it should never be sent for a ...Prior option
|
||||
observersMinimumOptions &= ~CPKeyValueObservingOptionNew;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -927,55 +956,97 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
||||
|
||||
[changes removeObjectForKey:CPKeyValueChangeNotificationIsPriorKey];
|
||||
|
||||
var indexes = [changes objectForKey:CPKeyValueChangeIndexesKey],
|
||||
setMutationKind = changes[_CPKeyValueChangeSetMutationKindKey];
|
||||
observersMinimumOptions = _minOptionsForKey[aKey];
|
||||
|
||||
if (setMutationKind)
|
||||
if (observersMinimumOptions & CPKeyValueObservingOptionNew)
|
||||
{
|
||||
//old and new values for unordered to-many relationships can only be calculated before
|
||||
//set recalculated hidden new value as soon as "didChangeValue..." is called!
|
||||
var newValue = changes[_CPKeyValueChangeSetMutationNewValueKey];
|
||||
[changes setValue:newValue forKey:CPKeyValueChangeNewKey];
|
||||
var indexes = [changes objectForKey:CPKeyValueChangeIndexesKey],
|
||||
setMutationKind = changes[_CPKeyValueChangeSetMutationKindKey];
|
||||
|
||||
//delete hidden values
|
||||
delete changes[_CPKeyValueChangeSetMutationNewValueKey];
|
||||
delete changes[_CPKeyValueChangeSetMutationObjectsKey];
|
||||
delete changes[_CPKeyValueChangeSetMutationKindKey];
|
||||
}
|
||||
else if (indexes)
|
||||
{
|
||||
var type = [changes objectForKey:CPKeyValueChangeKindKey];
|
||||
|
||||
// for ordered to-many relationships, newvalue is only sensible for replace and insert
|
||||
if (type == CPKeyValueChangeReplacement || type == CPKeyValueChangeInsertion)
|
||||
if (setMutationKind)
|
||||
{
|
||||
//FIXME: do we need to go through and replace "" with CPNull?
|
||||
var newValues = [[_targetObject mutableArrayValueForKeyPath:aKey] objectsAtIndexes:indexes];
|
||||
[changes setValue:newValues forKey:CPKeyValueChangeNewKey];
|
||||
//old and new values for unordered to-many relationships can only be calculated before
|
||||
//set recalculated hidden new value as soon as "didChangeValue..." is called!
|
||||
var newValue = changes[_CPKeyValueChangeSetMutationNewValueKey];
|
||||
[changes setValue:newValue forKey:CPKeyValueChangeNewKey];
|
||||
|
||||
//delete hidden values
|
||||
delete changes[_CPKeyValueChangeSetMutationNewValueKey];
|
||||
delete changes[_CPKeyValueChangeSetMutationObjectsKey];
|
||||
delete changes[_CPKeyValueChangeSetMutationKindKey];
|
||||
}
|
||||
else if (indexes)
|
||||
{
|
||||
var type = [changes objectForKey:CPKeyValueChangeKindKey];
|
||||
|
||||
// for ordered to-many relationships, newvalue is only sensible for replace and insert
|
||||
if (type == CPKeyValueChangeReplacement || type == CPKeyValueChangeInsertion)
|
||||
{
|
||||
//FIXME: do we need to go through and replace "" with CPNull?
|
||||
var newValues = [[_targetObject mutableArrayValueForKeyPath:aKey] objectsAtIndexes:indexes];
|
||||
[changes setValue:newValues forKey:CPKeyValueChangeNewKey];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var newValue = [_targetObject valueForKey:aKey];
|
||||
|
||||
if (newValue === nil || newValue === undefined)
|
||||
newValue = [CPNull null];
|
||||
|
||||
[changes setObject:newValue forKey:CPKeyValueChangeNewKey];
|
||||
}
|
||||
}
|
||||
|
||||
delete _minOptionsForKey[aKey];
|
||||
delete _changesForKey[aKey];
|
||||
}
|
||||
|
||||
var count = observers ? observers.length : 0,
|
||||
changesCache = {};
|
||||
|
||||
while (count--)
|
||||
{
|
||||
var observerInfo = observers[count],
|
||||
options = observerInfo.options,
|
||||
onlyNewAndOldOptions = options & kvoNewAndOld,
|
||||
observerChanges = nil;
|
||||
|
||||
if (isBefore)
|
||||
{
|
||||
// Only send 'observeValueForKeyPath:' for '...Prior' option when handling 'willChangeValue...'
|
||||
if (options & CPKeyValueObservingOptionPrior)
|
||||
{
|
||||
observerChanges = changes;
|
||||
// The new values are not yet created in the change dictionary so remove ...New option to get a working cache below
|
||||
onlyNewAndOldOptions &= ~CPKeyValueObservingOptionNew;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var newValue = [_targetObject valueForKey:aKey];
|
||||
|
||||
if (newValue === nil || newValue === undefined)
|
||||
newValue = [CPNull null];
|
||||
|
||||
[changes setObject:newValue forKey:CPKeyValueChangeNewKey];
|
||||
observerChanges = changes;
|
||||
}
|
||||
|
||||
delete _changesForKey[aKey];
|
||||
}
|
||||
|
||||
var observers = [_observersForKey[aKey] allValues],
|
||||
count = observers ? observers.length : 0;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
var observerInfo = observers[count];
|
||||
|
||||
if (!isBefore || (observerInfo.options & CPKeyValueObservingOptionPrior))
|
||||
[observerInfo.observer observeValueForKeyPath:aKey ofObject:_targetObject change:changes context:observerInfo.context];
|
||||
if (observerChanges)
|
||||
{
|
||||
// Don't change the 'change' dictionary when the observer wants the minimum options.
|
||||
// The ...New option is remved above for the ...Prior case
|
||||
if (onlyNewAndOldOptions !== observersMinimumOptions)
|
||||
{
|
||||
// Use a subset of the 'change' dictionary. First try to find it in the cache
|
||||
observerChanges = changesCache[onlyNewAndOldOptions];
|
||||
if (!observerChanges)
|
||||
{
|
||||
// Not in the cache. Build a new dictionary and store it in the cache
|
||||
changesCache[onlyNewAndOldOptions] = observerChanges = [changes mutableCopy];
|
||||
if (!(onlyNewAndOldOptions & CPKeyValueObservingOptionOld))
|
||||
[observerChanges removeObjectForKey:CPKeyValueChangeOldKey];
|
||||
if (!(onlyNewAndOldOptions & CPKeyValueObservingOptionNew))
|
||||
[observerChanges removeObjectForKey:CPKeyValueChangeNewKey];
|
||||
}
|
||||
}
|
||||
[observerInfo.observer observeValueForKeyPath:aKey ofObject:_targetObject change:observerChanges context:observerInfo.context];
|
||||
}
|
||||
}
|
||||
|
||||
var dependentKeysMap = _nativeClass[DependentKeysKey];
|
||||
@@ -1226,13 +1297,21 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
||||
{
|
||||
if (aKeyPath === _firstPart)
|
||||
{
|
||||
var oldValue = [_value valueForKeyPath:_secondPart],
|
||||
newValue = [_object valueForKeyPath:_firstPart + "." + _secondPart],
|
||||
pathChanges = @{
|
||||
CPKeyValueChangeNewKey: newValue ? newValue : [CPNull null],
|
||||
CPKeyValueChangeOldKey: oldValue ? oldValue : [CPNull null],
|
||||
CPKeyValueChangeKindKey: CPKeyValueChangeSetting,
|
||||
};
|
||||
var pathChanges = [CPMutableDictionary dictionaryWithObject:CPKeyValueChangeSetting forKey:CPKeyValueChangeKindKey];
|
||||
|
||||
if (_options & CPKeyValueObservingOptionOld)
|
||||
{
|
||||
var oldValue = [_value valueForKeyPath:_secondPart];
|
||||
|
||||
[pathChanges setObject:oldValue != null ? oldValue : [CPNull null] forKey:CPKeyValueChangeOldKey];
|
||||
}
|
||||
|
||||
if (_options & CPKeyValueObservingOptionNew)
|
||||
{
|
||||
var newValue = [_object valueForKeyPath:_firstPart + "." + _secondPart];
|
||||
|
||||
[pathChanges setObject:newValue != null ? newValue : [CPNull null] forKey:CPKeyValueChangeNewKey];
|
||||
}
|
||||
|
||||
[_observer observeValueForKeyPath:_firstPart + "." + _secondPart ofObject:_object change:pathChanges context:_context];
|
||||
|
||||
|
||||
+18
-3
@@ -345,6 +345,7 @@ var CPStringUIDs = new CFMutableDictionary(),
|
||||
specified mask which can be a combination of:
|
||||
<pre>
|
||||
CPCaseInsensitiveSearch
|
||||
CPDiacriticInsensitiveSearch
|
||||
CPLiteralSearch
|
||||
CPBackwardsSearch
|
||||
CPAnchoredSearch
|
||||
@@ -366,6 +367,7 @@ var CPStringUIDs = new CFMutableDictionary(),
|
||||
options specified in the specified mask which can be a combination of:
|
||||
<pre>
|
||||
CPCaseInsensitiveSearch
|
||||
CPDiacriticInsensitiveSearch
|
||||
CPLiteralSearch
|
||||
CPBackwardsSearch
|
||||
CPAnchoredSearch
|
||||
@@ -393,6 +395,11 @@ var CPStringUIDs = new CFMutableDictionary(),
|
||||
string = string.toLowerCase();
|
||||
aString = aString.toLowerCase();
|
||||
}
|
||||
if (aMask & CPDiacriticInsensitiveSearch)
|
||||
{
|
||||
string = string.stripDiacritics();
|
||||
aString = aString.stripDiacritics();
|
||||
}
|
||||
|
||||
if (aMask & CPBackwardsSearch)
|
||||
{
|
||||
@@ -682,6 +689,14 @@ var CPStringNull = [CPNull null];
|
||||
return self.toUpperCase();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a copy of the string stripped of diacritical marks.
|
||||
*/
|
||||
- (CPString)stripDiacritics
|
||||
{
|
||||
return self.stripDiacritics();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the text as a floating point value.
|
||||
*/
|
||||
@@ -948,9 +963,9 @@ var CPStringNull = [CPNull null];
|
||||
|
||||
@end
|
||||
|
||||
|
||||
var diacritics = [[192,198],[224,230],[231,231],[232,235],[236,239],[242,246],[249,252]], // Basic Latin ; Latin-1 Supplement.
|
||||
normalized = [65,97,99,101,105,111,117];
|
||||
var diacritics = [[192,198],[200,203],[204,207],[210,214],[217,220],[224,230],
|
||||
[231,231],[232,235],[236,239],[242,246],[249,252]], // Basic Latin ; Latin-1 Supplement.
|
||||
normalized = [65,69,73,79,85,97,99,101,105,111,117];
|
||||
|
||||
String.prototype.stripDiacritics = function()
|
||||
{
|
||||
|
||||
@@ -535,7 +535,7 @@ var StandardUserDefaults;
|
||||
*/
|
||||
- (void)setFloat:(float)aValue forKey:(CPString)aKey
|
||||
{
|
||||
if ([aValue respondsToSelector:@selector(aValue)])
|
||||
if ([aValue respondsToSelector:@selector(floatValue)])
|
||||
aValue = [aValue floatValue];
|
||||
|
||||
[self setObject:parseFloat(aValue) forKey:aKey];
|
||||
|
||||
@@ -68,6 +68,8 @@ with (window)
|
||||
// runs the objj repl or file provided in args
|
||||
exports.run = function(args)
|
||||
{
|
||||
var multipleFiles = false;
|
||||
|
||||
if (args)
|
||||
{
|
||||
// we expect args to be in the format:
|
||||
@@ -79,27 +81,82 @@ exports.run = function(args)
|
||||
// copy the args since we're going to modify them
|
||||
var argv = args.slice(1);
|
||||
|
||||
if (argv[0] === "--version")
|
||||
if (argv[0] === "--version" || argv[0] === "-v")
|
||||
{
|
||||
print(exports.fullVersionString());
|
||||
return;
|
||||
}
|
||||
|
||||
while (argv.length && argv[0].indexOf('-I') === 0)
|
||||
OBJJ_INCLUDE_PATHS.unshift.apply(OBJJ_INCLUDE_PATHS, argv.shift().substr(2).split(':'));
|
||||
if (argv[0] === "--help" || argv[0] === "-h")
|
||||
{
|
||||
print("Usage (objj): " + args[0] + " [options] [--] files...");
|
||||
print(" -v, --version print the current version of objj");
|
||||
print(" -I, --objj-include-paths include a specific framework paths")
|
||||
print(" -h, --help print this help");
|
||||
print(" -m, --multifiles launch objj on several files")
|
||||
return;
|
||||
}
|
||||
|
||||
while (argv.length && argv[0].indexOf('-') === 0)
|
||||
{
|
||||
switch (argv[0])
|
||||
{
|
||||
case "-I":
|
||||
argv.shift();
|
||||
OBJJ_INCLUDE_PATHS.unshift.apply(OBJJ_INCLUDE_PATHS, argv.shift().split(":"));
|
||||
break;
|
||||
|
||||
case "-m":
|
||||
argv.shift();
|
||||
multipleFiles = true;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (argv && argv.length > 0)
|
||||
{
|
||||
var arg0 = argv.shift();
|
||||
var mainFilePath = FILE.canonical(arg0);
|
||||
var endCommand = false;
|
||||
|
||||
exports.make_narwhal_factory(mainFilePath)(require, { }, module, system, print);
|
||||
while (argv.length > 0)
|
||||
{
|
||||
var arg0 = argv.shift();
|
||||
var mainFilePath = FILE.canonical(arg0);
|
||||
|
||||
if (typeof main === "function")
|
||||
main([arg0].concat(argv));
|
||||
if (multipleFiles)
|
||||
{
|
||||
// This is needed to process every files passed in args
|
||||
// Otherwise it would stop when an error is raised or we would like to objj the other given files
|
||||
try
|
||||
{
|
||||
exports.make_narwhal_factory(mainFilePath)(require, { }, module, system, print);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
print("\n" + e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
exports.make_narwhal_factory(mainFilePath)(require, { }, module, system, print);
|
||||
}
|
||||
|
||||
require("browser/timeout").serviceTimeouts();
|
||||
if (typeof main === "function")
|
||||
{
|
||||
main([arg0].concat(argv));
|
||||
endCommand = true;
|
||||
}
|
||||
|
||||
require("browser/timeout").serviceTimeouts();
|
||||
|
||||
if (!multipleFiles || endCommand)
|
||||
break;
|
||||
|
||||
ObjectiveJ.Executable.resetCachedFileExecutableSearchers();
|
||||
ObjectiveJ.StaticResource.resetRootResources();
|
||||
ObjectiveJ.FileExecutable.resetFileExecutables();
|
||||
objj_resetRegisterClasses();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -35,7 +35,12 @@ function BundleTask(aName, anApplication)
|
||||
{
|
||||
Task.apply(this, arguments);
|
||||
|
||||
this.setEnvironments([environment.Browser, environment.CommonJS]);
|
||||
var ignoreCommonJS = system.env["CAPP_IGNORE_COMMONJS_ENV"];
|
||||
|
||||
if (ignoreCommonJS && ignoreCommonJS.toLowerCase() == "no" || ignoreCommonJS == "1")
|
||||
this.setEnvironments([environment.Browser]);
|
||||
else
|
||||
this.setEnvironments([environment.Browser, environment.CommonJS]);
|
||||
|
||||
this._author = null;
|
||||
this._email = null;
|
||||
|
||||
@@ -383,7 +383,7 @@ var ObjJAcornCompiler = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*
|
||||
this.tokens = exports.acorn.parse(aString);
|
||||
}
|
||||
catch (e) {
|
||||
if (e.lineStart)
|
||||
if (e.lineStart != null)
|
||||
{
|
||||
var message = this.prettifyMessage(e, "ERROR");
|
||||
#ifdef BROWSER
|
||||
@@ -1705,6 +1705,8 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
compiler.currentSuperMetaClass = "objj_getMetaClass(\"" + className + "\").super_class";
|
||||
|
||||
var firstIvarDeclaration = true,
|
||||
ivars = classDef.ivars,
|
||||
classDefIvars = [],
|
||||
hasAccessors = false;
|
||||
|
||||
// Then we add all ivars
|
||||
@@ -1714,7 +1716,6 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
var ivarDecl = node.ivardeclarations[i],
|
||||
ivarType = ivarDecl.ivartype ? ivarDecl.ivartype.name : null,
|
||||
ivarName = ivarDecl.id.name,
|
||||
ivars = classDef.ivars,
|
||||
ivar = {"type": ivarType, "name": ivarName},
|
||||
accessors = ivarDecl.accessors;
|
||||
|
||||
@@ -1736,7 +1737,10 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
|
||||
if (ivarDecl.outlet)
|
||||
ivar.outlet = true;
|
||||
ivars[ivarName] = ivar;
|
||||
|
||||
// Store the classDef ivars into array and add them later when accessors are created to prevent ivar duplicate error when generating accessors
|
||||
classDefIvars.push(ivar);
|
||||
|
||||
if (!classScope.ivars)
|
||||
classScope.ivars = Object.create(null);
|
||||
classScope.ivars[ivarName] = {type: "ivar", name: ivarName, node: ivarDecl.id, ivar: ivar};
|
||||
@@ -1774,7 +1778,8 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
var getterSetterBuffer = new StringBuffer();
|
||||
|
||||
// Add the class declaration to compile accessors correctly
|
||||
getterSetterBuffer.concat(compiler.source.substring(node.start, node.endOfIvars));
|
||||
// Remove all protocols from class declaration
|
||||
getterSetterBuffer.concat(compiler.source.substring(node.start, node.endOfIvars).replace(/<.*>/g, ""));
|
||||
getterSetterBuffer.concat("\n");
|
||||
|
||||
for (var i = 0; i < node.ivardeclarations.length; ++i)
|
||||
@@ -1826,7 +1831,16 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
compiler.imBuffer.concat(imBuffer);
|
||||
}
|
||||
|
||||
// We will store the classDef first after accessors are done so we don't get a duplicate class error
|
||||
// We will store the ivars into the classDef first after accessors are done so we don't get a duplicate ivars error when generating accessors
|
||||
for (var ivarSize = classDefIvars.length, i = 0; i < ivarSize; i++) {
|
||||
var ivar = classDefIvars[i],
|
||||
ivarName = ivar.name;
|
||||
|
||||
// Store the ivar into the classDef
|
||||
ivars[ivarName] = ivar;
|
||||
}
|
||||
|
||||
// We will store the classDef first after accessors are done so we don't get a duplicate class error when generating accessors
|
||||
compiler.classDefs[className] = classDef;
|
||||
|
||||
var bodies = node.body,
|
||||
@@ -1880,8 +1894,15 @@ ClassDeclarationStatement: function(node, st, c) {
|
||||
// Lookup the protocolDefs for the protocols
|
||||
var protocolDefs = [];
|
||||
|
||||
for (var i = 0, size = protocols.length; i < size; i++)
|
||||
protocolDefs.push(compiler.getProtocolDef(protocols[i].name));
|
||||
for (var i = 0, size = protocols.length; i < size; i++) {
|
||||
var protocol = protocols[i],
|
||||
protocolDef = compiler.getProtocolDef(protocol.name);
|
||||
|
||||
if (!protocolDef)
|
||||
throw compiler.error_message("Cannot find protocol declaration for '" + protocol.name + "'", protocol);
|
||||
|
||||
protocolDefs.push(protocolDef);
|
||||
}
|
||||
|
||||
var unimplementedMethods = classDef.listOfNotImplementedMethodsForProtocols(protocolDefs);
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
|
||||
CPArray observations;
|
||||
int aCount @accessors;
|
||||
|
||||
CPArray nameValues @accessors;
|
||||
CPArray depValues @accessors;
|
||||
}
|
||||
|
||||
- (CPArray)makeTestArray
|
||||
@@ -19,6 +22,22 @@
|
||||
[Employee employeeWithName:@"Tom" department:[Department departmentWithName:@"CommonJS"]]];
|
||||
}
|
||||
|
||||
- (CPArray)makeTestArrayMany
|
||||
{
|
||||
var a = [[Employee employeeWithName:@"Francisco" department:[Department departmentWithName:@"Cappuccino"]],
|
||||
[Employee employeeWithName:@"Ross" department:[Department departmentWithName:@"Cappuccino"]],
|
||||
[Employee employeeWithName:@"Tom" department:[Department departmentWithName:@"CommonJS"]]];
|
||||
|
||||
var i = 10000;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
[a addObject:[Employee employeeWithName:@"Martin" + i department:[Department departmentWithName:@"Magic Lightning"]]];
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
- (void)initControllerWithSimpleArray
|
||||
{
|
||||
// Copy the array to allow the original to be reused.
|
||||
@@ -1054,6 +1073,54 @@
|
||||
[self assert:[1, 2, 3] equals:[arrayController1 arrangedObjects] message:"normal selection"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Test that bindings are not generation any change dictionary with Old or New values as a observer
|
||||
*/
|
||||
- (void)testCreationOfOldAndNeChangeDictionaryinObserverProtocol
|
||||
{
|
||||
[self initControllerWithContentBinding];
|
||||
|
||||
var arrayController = [self arrayController];
|
||||
|
||||
[self bind:@"nameValues" toObject:arrayController withKeyPath:@"arrangedObjects.name" options:nil];
|
||||
|
||||
countGetName = 0;
|
||||
|
||||
[self setItemsArray:[]];
|
||||
[self assert:0 equals:countGetName];
|
||||
|
||||
countGetName = 0;
|
||||
|
||||
[self setItemsArray:[self makeTestArray]];
|
||||
[self assert:3 equals:countGetName message:@"3 items in array and one '.name' bindings should make 3 accesses to the name property not " + countGetName + " times"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Test the speed of set an big array when the old was an empty.
|
||||
Also test the speed when an empty array is set and the old is an big
|
||||
*/
|
||||
- (void)testPerformance
|
||||
{
|
||||
[self initControllerWithContentBinding];
|
||||
|
||||
var arrayController = [self arrayController];
|
||||
[self bind:@"nameValues" toObject:arrayController withKeyPath:@"arrangedObjects.name" options:nil];
|
||||
[self bind:@"depValues" toObject:arrayController withKeyPath:@"arrangedObjects.department" options:nil];
|
||||
|
||||
[self setItemsArray:[]];
|
||||
var bigArray = [self makeTestArrayMany];
|
||||
|
||||
var d = new Date();
|
||||
[self setItemsArray:bigArray];
|
||||
var dd = new Date();
|
||||
[self setItemsArray:[]];
|
||||
var ddd = new Date();
|
||||
|
||||
CPLog.warn("\n" + [self className] + " Performance tests");
|
||||
CPLog.warn("EmptyArray -> BigArray (" + [bigArray count] + "): " + (dd - d) + "ms.");
|
||||
CPLog.warn("BigArray (" + [bigArray count] + ") -> EmptyArray: " + (ddd - dd) + "ms.");
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:keyPath
|
||||
ofObject:anActivity
|
||||
change:change
|
||||
@@ -1099,8 +1166,20 @@
|
||||
[_contentArray replaceObjectAtIndex:index withObject:anObject];
|
||||
}
|
||||
|
||||
- (void)setItemsArray:(CPArray)newValue
|
||||
{
|
||||
[self setValue:newValue forKey:@"contentArray"];
|
||||
}
|
||||
|
||||
- (CPArray)itemsArray
|
||||
{
|
||||
return [self valueForKey:@"contentArray"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var countGetName;
|
||||
|
||||
@implementation Employee : CPObject
|
||||
{
|
||||
CPString _name @accessors(property=name);
|
||||
@@ -1128,6 +1207,12 @@
|
||||
return [CPString stringWithFormat:@"<Employee %@>", [self name]];
|
||||
}
|
||||
|
||||
- (CPString)name
|
||||
{
|
||||
countGetName++;
|
||||
return _name;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation Department : CPObject
|
||||
|
||||
@@ -13,12 +13,6 @@
|
||||
_globalResults = nil;
|
||||
}
|
||||
|
||||
// delegate method
|
||||
- (void)collectionViewDidChangeSelection:(CPCollectionView)aCollectionView
|
||||
{
|
||||
_globalResults = "selection changed: " + [[aCollectionView selectionIndexes] count];
|
||||
}
|
||||
|
||||
- (void)testItemPrototypeActuallyReturnsTheItemPrototype
|
||||
{
|
||||
var itemPrototype = [[CPCollectionViewItem alloc] init];
|
||||
@@ -57,38 +51,6 @@
|
||||
[self assert:[collectionView reloadContentCallCount] equals:reloadContentCount + 1 message:@"subsequent calls to setContent should have called reloadContent once"];
|
||||
}
|
||||
|
||||
- (void)testCallCollectionViewDidChangeSelectionDelegateMethod
|
||||
{
|
||||
var content1 = ["a", "b", "c"],
|
||||
content2 = ["d", "e", "f"];
|
||||
|
||||
[_collectionView setSelectable:YES];
|
||||
[_collectionView setDelegate:self];
|
||||
[_collectionView setContent:content1];
|
||||
[_collectionView setSelectionIndexes:[CPIndexSet indexSetWithIndex:0]];
|
||||
// the first time the delegate does get called
|
||||
[self assert:"selection changed: 1" equals:_globalResults];
|
||||
_globalResults = nil;
|
||||
|
||||
// setContent: by itself should not affect the selection.
|
||||
[_collectionView setContent:content1];
|
||||
[self assert:nil equals:_globalResults];
|
||||
// Manually clear the selection.
|
||||
[_collectionView setSelectionIndexes:[CPIndexSet indexSet]];
|
||||
_globalResults = nil;
|
||||
|
||||
|
||||
// now lets change the contents
|
||||
[_collectionView setContent:content2];
|
||||
// we set the selection to 0 again, but on the NEW content
|
||||
[_collectionView setSelectionIndexes:[CPIndexSet indexSetWithIndex:0]];
|
||||
[self assert:"selection changed: 1" equals:_globalResults];
|
||||
|
||||
_globalResults = nil;
|
||||
[_collectionView setSelectionIndexes:[CPIndexSet indexSetWithIndex:1]];
|
||||
[self assert:"selection changed: 1" equals:_globalResults];
|
||||
}
|
||||
|
||||
- (void)testSelectionIndexes
|
||||
{
|
||||
[_collectionView setSelectionIndexes:[CPIndexSet indexSetWithIndex:0]];
|
||||
|
||||
@@ -342,6 +342,24 @@
|
||||
[self assert:@"brie" equals:[control2 objectValue] message:@"control2 objectValue is wrong"];
|
||||
}
|
||||
|
||||
- (void)testExclusiveBindings
|
||||
{
|
||||
var segmented = [[CPSegmentedControl alloc] initWithFrame:CGRectMakeZero()];
|
||||
[segmented setSegmentCount:3];
|
||||
|
||||
var model = [BindingTester testerWithCheese:2];
|
||||
|
||||
[segmented bind:CPSelectedIndexBinding toObject:model withKeyPath:@"cheese" options:nil];
|
||||
|
||||
// Try to bind another binding (mutually exclusive) to the same value.
|
||||
[segmented bind:CPSelectedTagBinding toObject:model withKeyPath:@"cheese" options:nil];
|
||||
|
||||
[self assertNotNull:[segmented infoForBinding:CPSelectedIndexBinding]];
|
||||
|
||||
// Check that the source is not binded with the CPSelectedTagBinding
|
||||
[self assertNull:[segmented infoForBinding:CPSelectedTagBinding]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TextField : CPTextField
|
||||
|
||||
@@ -209,6 +209,68 @@
|
||||
[self assertTrue:[outlineView isItemExpanded:".1"] message:".1 is still expanded, cannot collapse"];
|
||||
}
|
||||
|
||||
- (void)testRowForItem
|
||||
{
|
||||
[self assert:2 equals:[outlineView rowForItem:@".1.2"] message:".1.2 row number is wrong"];
|
||||
[self assert:6 equals:[outlineView rowForItem:@".3"] message:".3 row number is wrong"];
|
||||
[outlineView collapseItem:".1"];
|
||||
[self assert:CPNotFound equals:[outlineView rowForItem:@".1.2"] message:".1.2 row number is wrong"];
|
||||
[self assert:2 equals:[outlineView rowForItem:@".3"] message:".3 row number is wrong"];
|
||||
[outlineView expandItem:".1"];
|
||||
[self assert:2 equals:[outlineView rowForItem:@".1.2"] message:".1.2 row number is wrong"];
|
||||
[self assert:6 equals:[outlineView rowForItem:@".3"] message:".3 row is number wrong"];
|
||||
}
|
||||
|
||||
- (void)testItemAtRow
|
||||
{
|
||||
[self assert:@".1.2" equals:[outlineView itemAtRow:2] message:"itemAtRow 2 is wrong"];
|
||||
[self assert:@".3" equals:[outlineView itemAtRow:6] message:"itemAtRow 6 is wrong"];
|
||||
[self assert:nil equals:[outlineView itemAtRow:8] message:"itemAtRow 8 is wrong"];
|
||||
[outlineView collapseItem:".1"];
|
||||
[self assert:@".3" equals:[outlineView itemAtRow:2] message:"itemAtRow 2 is wrong"];
|
||||
[self assert:nil equals:[outlineView itemAtRow:5] message:"itemAtRow 5 is wrong"];
|
||||
[outlineView expandItem:".1"];
|
||||
[self assert:@".1.2" equals:[outlineView itemAtRow:2] message:"itemAtRow 2 is wrong"];
|
||||
[self assert:@".3" equals:[outlineView itemAtRow:6] message:"itemAtRow 6 is wrong"];
|
||||
[self assert:nil equals:[outlineView itemAtRow:8] message:".itemAtRow 8 is wrong"];
|
||||
}
|
||||
|
||||
- (void)testItemIsExpanded
|
||||
{
|
||||
[self assert:YES equals:[outlineView isItemExpanded:@".1.2"] message:".1.2 expanded value is wrong"];
|
||||
[self assert:YES equals:[outlineView isItemExpanded:@".3"] message:".3 expanded value is wrong"];
|
||||
[outlineView collapseItem:".1"];
|
||||
[self assert:NO equals:[outlineView isItemExpanded:@".1.2"] message:".1.2 expanded value is wrong"];
|
||||
[self assert:YES equals:[outlineView isItemExpanded:@".3"] message:".3 expanded value is wrong"];
|
||||
[outlineView expandItem:".1"];
|
||||
[self assert:YES equals:[outlineView isItemExpanded:@".1.2"] message:".1.2 expanded value is wrong"];
|
||||
[self assert:YES equals:[outlineView isItemExpanded:@".3"] message:".3 expanded value is wrong"];
|
||||
}
|
||||
|
||||
- (void)testLevelForItem
|
||||
{
|
||||
[self assert:1 equals:[outlineView levelForItem:@".1.2"] message:".1.2 level value is wrong"];
|
||||
[self assert:0 equals:[outlineView levelForItem:@".3"] message:".3 level value is wrong"];
|
||||
[outlineView collapseItem:".1"];
|
||||
[self assert:CPNotFound equals:[outlineView levelForItem:@".1.2"] message:".1.2 level value is wrong"];
|
||||
[self assert:0 equals:[outlineView levelForItem:@".3"] message:".3 level value is wrong"];
|
||||
[outlineView expandItem:".1"];
|
||||
[self assert:1 equals:[outlineView levelForItem:@".1.2"] message:".1.2 level value is wrong"];
|
||||
[self assert:0 equals:[outlineView levelForItem:@".3"] message:".3 level value is wrong"];
|
||||
}
|
||||
|
||||
- (void)testLevelForRow
|
||||
{
|
||||
[self assert:2 equals:[outlineView levelForRow:3] message:"levelForRow 2 is wrong"];
|
||||
[self assert:0 equals:[outlineView levelForRow:6] message:"levelForRow 6 is wrong"];
|
||||
[outlineView collapseItem:".1"];
|
||||
[self assert:0 equals:[outlineView levelForRow:2] message:"levelForRow 2 is wrong"];
|
||||
[self assert:CPNotFound equals:[outlineView levelForRow:4] message:"levelForRow 4 is wrong"];
|
||||
[outlineView expandItem:".1"];
|
||||
[self assert:2 equals:[outlineView levelForRow:3] message:"levelForRow 2 is wrong"];
|
||||
[self assert:0 equals:[outlineView levelForRow:6] message:"levelForRow 0 is wrong"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Test that the outline view archives properly.
|
||||
*/
|
||||
|
||||
@@ -4,14 +4,33 @@
|
||||
|
||||
[CPApplication sharedApplication]
|
||||
|
||||
var methodCalled;
|
||||
|
||||
@implementation CPViewTest : OJTestCase
|
||||
{
|
||||
CPView view;
|
||||
CPView view1;
|
||||
CPView view2;
|
||||
CPView view3;
|
||||
|
||||
CPWindow window;
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
window = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 1000.0, 1000.0) styleMask:CPWindowNotSizable];
|
||||
|
||||
view = [[CPView alloc] initWithFrame:CGRectMakeZero()];
|
||||
view1 = [[CPResponderView alloc] initWithFrame:CGRectMakeZero()];
|
||||
view2 = [[CPResponderView alloc] initWithFrame:CGRectMakeZero()];
|
||||
view3 = [[CPResponderView alloc] initWithFrame:CGRectMakeZero()];
|
||||
|
||||
[view1 setIdentifier:@"view1"];
|
||||
[view2 setIdentifier:@"view2"];
|
||||
[view3 setIdentifier:@"view3"];
|
||||
|
||||
methodCalled = [];
|
||||
|
||||
[super setUp];
|
||||
}
|
||||
|
||||
@@ -446,10 +465,213 @@
|
||||
[self assertFalse:[subview hasThemeState:CPThemeStateFirstResponder]];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedSubviewMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", "viewWillMoveToWindow_view1", "viewDidMoveToWindow_view1"];
|
||||
|
||||
[[window contentView] addSubview:view1];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedSubviewWithoutWindowMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view2", @"viewDidMoveToSuperview_view2"];
|
||||
|
||||
[view1 addSubview:view2];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedSubviewTwiceMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", "viewWillMoveToWindow_view1", "viewDidMoveToWindow_view1", @"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", "viewWillMoveToWindow_view1", "viewDidMoveToWindow_view1"];
|
||||
|
||||
[[window contentView] addSubview:view1];
|
||||
[[window contentView] addSubview:view1];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenRemovedSubviewMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1"];
|
||||
|
||||
[view1 removeFromSuperview];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedSubviewThenRemovedSubviewMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", "viewWillMoveToWindow_view1", "viewDidMoveToWindow_view1"];
|
||||
|
||||
[[window contentView] addSubview:view1];
|
||||
|
||||
methodCalled = [];
|
||||
[view1 removeFromSuperview];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedSubviewThenRemovedSubviewWithoutWindowMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1"];
|
||||
|
||||
[view1 addSubview:view2];
|
||||
|
||||
methodCalled = [];
|
||||
[view1 removeFromSuperview];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedTwoSubviewsMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view2", @"viewDidMoveToSuperview_view2",@"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", "viewWillMoveToWindow_view1", "viewWillMoveToWindow_view2", "viewDidMoveToWindow_view2", "viewDidMoveToWindow_view1"];
|
||||
|
||||
[view1 addSubview:view2];
|
||||
[[window contentView] addSubview:view1];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedTwoSubviewsThenRemovedMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", "viewWillMoveToWindow_view1", "viewWillMoveToWindow_view2", "viewDidMoveToWindow_view2", "viewDidMoveToWindow_view1"];
|
||||
|
||||
[view1 addSubview:view2];
|
||||
[[window contentView] addSubview:view1];
|
||||
|
||||
methodCalled = [];
|
||||
[view1 removeFromSuperview];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedTwoSubviewsThenAddedTheViewToAnotherViewWithoutWindowMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", @"viewWillMoveToWindow_view1", @"viewDidMoveToWindow_view1", @"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", @"viewWillMoveToWindow_view1", @"viewDidMoveToWindow_view1"];
|
||||
|
||||
[[window contentView] addSubview:view1];
|
||||
[view2 addSubview:view1];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedOneSubviewsWithSetSubviewsMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", "viewWillMoveToWindow_view1", "viewDidMoveToWindow_view1"];
|
||||
|
||||
[[window contentView] setSubviews:[view1]];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedTwoSubviewsWithSetSubviewsMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", "viewWillMoveToWindow_view1", "viewDidMoveToWindow_view1", @"viewWillMoveToSuperview_view2", @"viewDidMoveToSuperview_view2", "viewWillMoveToWindow_view2", "viewDidMoveToWindow_view2"];
|
||||
|
||||
[[window contentView] setSubviews:[view1, view2]];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedTwoSubviewsThenSetSubviewsWithOneViewMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view2", @"viewDidMoveToSuperview_view2", "viewWillMoveToWindow_view2", "viewDidMoveToWindow_view2"];
|
||||
|
||||
[[window contentView] setSubviews:[view1, view2]];
|
||||
|
||||
methodCalled = [];
|
||||
|
||||
[[window contentView] setSubviews:[view1]];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenAddedTwoSubviewsThenSetSubviewsWithTwoViewsMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view2", @"viewDidMoveToSuperview_view2", "viewWillMoveToWindow_view2", "viewDidMoveToWindow_view2", @"viewWillMoveToSuperview_view3", @"viewDidMoveToSuperview_view3", "viewWillMoveToWindow_view3", "viewDidMoveToWindow_view3"];
|
||||
|
||||
[[window contentView] setSubviews:[view1, view2]];
|
||||
|
||||
methodCalled = [];
|
||||
|
||||
[[window contentView] setSubviews:[view1, view3]];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenReplacedViewWithSameViewMethodCalled
|
||||
{
|
||||
var expectedRestult = [];
|
||||
|
||||
[[window contentView] addSubview:view1];
|
||||
|
||||
methodCalled = [];
|
||||
|
||||
[[window contentView] replaceSubview:view1 with:view1];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenReplacedViewWithOtherViewMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view2", @"viewDidMoveToSuperview_view2", "viewWillMoveToWindow_view2", "viewDidMoveToWindow_view2", @"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", "viewWillMoveToWindow_view1", "viewDidMoveToWindow_view1"];
|
||||
|
||||
[[window contentView] addSubview:view1];
|
||||
|
||||
methodCalled = [];
|
||||
|
||||
[[window contentView] replaceSubview:view1 with:view2];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
- (void)testWhenReplacedViewWithOtherAddedViewMethodCalled
|
||||
{
|
||||
var expectedRestult = [@"viewWillMoveToSuperview_view2", @"viewDidMoveToSuperview_view2", "viewWillMoveToWindow_view2", "viewDidMoveToWindow_view2", @"viewWillMoveToSuperview_view1", @"viewDidMoveToSuperview_view1", "viewWillMoveToWindow_view1", "viewDidMoveToWindow_view1"];
|
||||
|
||||
[[window contentView] addSubview:view1];
|
||||
[[window contentView] addSubview:view2];
|
||||
|
||||
methodCalled = [];
|
||||
|
||||
[[window contentView] replaceSubview:view1 with:view2];
|
||||
|
||||
[self assert:expectedRestult equals:methodCalled];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation CPResponderView : CPView
|
||||
|
||||
- (void)viewDidMoveToSuperview
|
||||
{
|
||||
var string = @"viewDidMoveToSuperview_" + [self identifier];
|
||||
[methodCalled addObject:string];
|
||||
}
|
||||
|
||||
- (void)viewDidMoveToWindow
|
||||
{
|
||||
var string = @"viewDidMoveToWindow_" + [self identifier];
|
||||
[methodCalled addObject:string];
|
||||
}
|
||||
|
||||
- (void)viewWillMoveToSuperview:(CPView)newSuperview
|
||||
{
|
||||
var string = @"viewWillMoveToSuperview_" + [self identifier];
|
||||
[methodCalled addObject:string];
|
||||
}
|
||||
|
||||
- (void)viewWillMoveToWindow:(CPWindow)newWindow
|
||||
{
|
||||
var string = @"viewWillMoveToWindow_" + [self identifier];
|
||||
[methodCalled addObject:string];
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
{
|
||||
bob = [[PersonTester alloc] init];
|
||||
|
||||
[bob addObserver:self forKeyPath:@"name" options:nil context:@"testAddObserver"];
|
||||
[bob addObserver:self forKeyPath:@"name" options:CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld context:@"testAddObserver"];
|
||||
|
||||
[bob setValue:@"bob" forKey:@"name"];
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
{
|
||||
bob = [[PersonTester alloc] init];
|
||||
|
||||
[bob addObserver:self forKeyPath:@"name" options:nil context:@"testUnobservedKey"];
|
||||
[bob addObserver:self forKeyPath:@"name" options:0 context:@"testUnobservedKey"];
|
||||
|
||||
[bob setValue:@"555" forKey:@"phoneNumber"];
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
{
|
||||
bob = [[PersonTester alloc] init];
|
||||
|
||||
[bob addObserver:self forKeyPath:@"name" options:nil context:@"testAddTwoObservers"];
|
||||
[bob addObserver:[CPObject new] forKeyPath:@"name" options:nil context:@"testAddTwoObservers"];
|
||||
[bob addObserver:self forKeyPath:@"name" options:CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld context:@"testAddTwoObservers"];
|
||||
[bob addObserver:[CPObject new] forKeyPath:@"name" options:CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld context:@"testAddTwoObservers"];
|
||||
|
||||
[bob setValue:@"bob" forKey:@"name"];
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
{
|
||||
bob = [[PersonTester alloc] init];
|
||||
|
||||
[bob addObserver:self forKeyPath:@"phoneNumber" options:nil context:@"testDirectIVarObservation"];
|
||||
[bob addObserver:self forKeyPath:@"phoneNumber" options:CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld context:@"testDirectIVarObservation"];
|
||||
|
||||
[bob setValue:@"555" forKey:@"phoneNumber"];
|
||||
|
||||
@@ -81,8 +81,8 @@
|
||||
{
|
||||
bob = [[PersonTester alloc] init];
|
||||
|
||||
[bob addObserver:self forKeyPath:@"name" options:nil context:@"testRemoveObserver"];
|
||||
[bob addObserver:[CPString new] forKeyPath:@"name" options:nil context:@"testRemoveObserver"];
|
||||
[bob addObserver:self forKeyPath:@"name" options:0 context:@"testRemoveObserver"];
|
||||
[bob addObserver:[CPString new] forKeyPath:@"name" options:0 context:@"testRemoveObserver"];
|
||||
|
||||
[bob removeObserver:self forKeyPath:@"name"];
|
||||
|
||||
@@ -96,8 +96,8 @@
|
||||
bob = [[PersonTester alloc] init];
|
||||
obj = [CPString new];
|
||||
|
||||
[bob addObserver:self forKeyPath:@"name" options:nil context:@"testRemoveOtherObserver"];
|
||||
[bob addObserver:obj forKeyPath:@"name" options:nil context:@"testRemoveOtherObserver"];
|
||||
[bob addObserver:self forKeyPath:@"name" options:CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld context:@"testRemoveOtherObserver"];
|
||||
[bob addObserver:obj forKeyPath:@"name" options:CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld context:@"testRemoveOtherObserver"];
|
||||
|
||||
[bob removeObserver:obj forKeyPath:@"name"];
|
||||
|
||||
@@ -113,8 +113,8 @@
|
||||
obj = [CPArray new];
|
||||
obj2 = [CPString new];
|
||||
|
||||
[bob addObserver:obj forKeyPath:@"name" options:nil context:@"testRemoveAllObservers"];
|
||||
[bob addObserver:obj2 forKeyPath:@"name" options:nil context:@"testRemoveAllObservers"];
|
||||
[bob addObserver:obj forKeyPath:@"name" options:0 context:@"testRemoveAllObservers"];
|
||||
[bob addObserver:obj2 forKeyPath:@"name" options:0 context:@"testRemoveAllObservers"];
|
||||
|
||||
[bob removeObserver:obj forKeyPath:@"name"];
|
||||
[bob removeObserver:obj2 forKeyPath:@"name"];
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
[dict addObserver:self
|
||||
forKeyPath:@"dictionaryKey"
|
||||
options:nil
|
||||
options:CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld
|
||||
context:@"testDictionary"];
|
||||
|
||||
[dict setObject:@"Jo Bob Ray" forKey:@"dictionaryKey"];
|
||||
@@ -147,7 +147,20 @@
|
||||
|
||||
bob = [[PersonTester alloc] init];
|
||||
|
||||
[bob addObserver:self forKeyPath:@"name" options:CPKeyValueObservingOptionPrior context:@"testPriorObservationOption"];
|
||||
[bob addObserver:self forKeyPath:@"name" options:CPKeyValueObservingOptionPrior | CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld context:@"testPriorObservationOption"];
|
||||
|
||||
[bob setValue:@"bob" forKey:@"name"];
|
||||
|
||||
[self assertTrue:_sawPriorObservation message:@"asked for CPKeyValueObservingOptionPrior but did not recieve corresponding notification"];
|
||||
}
|
||||
|
||||
- (void)testPriorObservationOptionNoOld
|
||||
{
|
||||
_sawPriorObservation = NO;
|
||||
|
||||
bob = [[PersonTester alloc] init];
|
||||
|
||||
[bob addObserver:self forKeyPath:@"name" options:CPKeyValueObservingOptionPrior | CPKeyValueObservingOptionNew context:@"testPriorObservationOptionNoOld"];
|
||||
|
||||
[bob setValue:@"bob" forKey:@"name"];
|
||||
|
||||
@@ -162,7 +175,23 @@
|
||||
|
||||
bob.name = "paul";
|
||||
|
||||
[bob addObserver:self forKeyPath:@"name" options:CPKeyValueObservingOptionInitial context:@"testInitialObservationOption"];
|
||||
[bob addObserver:self forKeyPath:@"name" options:CPKeyValueObservingOptionInitial | CPKeyValueObservingOptionNew context:@"testInitialObservationOption"];
|
||||
[bob removeObserver:self forKeyPath:@"name"];
|
||||
|
||||
[bob setValue:@"bob" forKey:@"name"];
|
||||
|
||||
[self assertTrue:_sawInitialObservation message:@"asked for CPKeyValueObservingOptionInitial but did not recieve corresponding notification"];
|
||||
}
|
||||
|
||||
- (void)testInitialObservationOptionNoNew
|
||||
{
|
||||
_sawInitialObservation = NO;
|
||||
|
||||
bob = [[PersonTester alloc] init];
|
||||
|
||||
bob.name = "paul";
|
||||
|
||||
[bob addObserver:self forKeyPath:@"name" options:CPKeyValueObservingOptionInitial context:@"testInitialObservationOptionNoNew"];
|
||||
[bob removeObserver:self forKeyPath:@"name"];
|
||||
|
||||
[bob setValue:@"bob" forKey:@"name"];
|
||||
@@ -178,8 +207,8 @@
|
||||
|
||||
bob.name = "paul";
|
||||
|
||||
[bob addObserver:self forKeyPath:@"bobName" options:0 context:@"testDependentKeyObservation"];
|
||||
[bob addObserver:self forKeyPath:@"twiceRemoved" options:0 context:@"testDependentKeyObservation2"];
|
||||
[bob addObserver:self forKeyPath:@"bobName" options:CPKeyValueObservingOptionOld context:@"testDependentKeyObservation"];
|
||||
[bob addObserver:self forKeyPath:@"twiceRemoved" options:CPKeyValueObservingOptionOld context:@"testDependentKeyObservation2"];
|
||||
|
||||
[bob setValue:@"bob" forKey:@"name"];
|
||||
|
||||
@@ -194,7 +223,7 @@
|
||||
|
||||
[cs101 setTeacher:bob];
|
||||
|
||||
[cs101 addObserver:self forKeyPath:@"teacher.name" options:0 context:@"testMultipartKey"];
|
||||
[cs101 addObserver:self forKeyPath:@"teacher.name" options:CPKeyValueObservingOptionNew context:@"testMultipartKey"];
|
||||
|
||||
[bob setName:@"bob"];
|
||||
|
||||
@@ -209,7 +238,7 @@
|
||||
|
||||
[bob setValue:focus forKey:@"car"];
|
||||
|
||||
[bob addObserver:self forKeyPath:@"self.car.thisCar.model" options:0 context:@"testMultiPartKeysWhereValuesEvaluateToSelf"];
|
||||
[bob addObserver:self forKeyPath:@"self.car.thisCar.model" options:CPKeyValueObservingOptionNew context:@"testMultiPartKeysWhereValuesEvaluateToSelf"];
|
||||
|
||||
[focus setValue:@"ford focus" forKey:@"model"];
|
||||
|
||||
@@ -225,7 +254,7 @@
|
||||
[cs101 setTeacher:bob];
|
||||
[bob setValue:focus forKey:@"car"];
|
||||
|
||||
[cs101 addObserver:self forKeyPath:@"teacher.car.model" options:0 context:@"testThreePartKey"];
|
||||
[cs101 addObserver:self forKeyPath:@"teacher.car.model" options:CPKeyValueObservingOptionNew context:@"testThreePartKey"];
|
||||
|
||||
[focus setValue:@"ford focus" forKey:@"model"];
|
||||
[self assertTrue: _sawObservation message:@"Never recieved an observation"];
|
||||
@@ -240,7 +269,7 @@
|
||||
[cs101 setTeacher:bob];
|
||||
[focus setValue:@"2000" forKey:@"year"];
|
||||
|
||||
[cs101 addObserver:self forKeyPath:@"teacher.car.year" options:0 context:@"testThreePartKeyPart2"];
|
||||
[cs101 addObserver:self forKeyPath:@"teacher.car.year" options:CPKeyValueObservingOptionNew context:@"testThreePartKeyPart2"];
|
||||
|
||||
[bob setValue:focus forKey:@"car"];
|
||||
|
||||
@@ -290,7 +319,7 @@
|
||||
[a setValue:[E new] forKeyPath:@"b.c.d.e"];
|
||||
[a setValue:[F new] forKeyPath:@"b.c.d.e.f"];
|
||||
|
||||
[a addObserver:self forKeyPath:@"b.c.d.e.f" options:0 context:@"testCrazyKeyPathChanges"];
|
||||
[a addObserver:self forKeyPath:@"b.c.d.e.f" options:CPKeyValueObservingOptionNew context:@"testCrazyKeyPathChanges"];
|
||||
|
||||
var newD = [D new];
|
||||
|
||||
@@ -311,7 +340,7 @@
|
||||
[a setValue:[E new] forKeyPath:@"b.c.d.e"];
|
||||
[a setValue:[F new] forKeyPath:@"b.c.d.e.f"];
|
||||
|
||||
[a addObserver:self forKeyPath:@"b.c.d.e.f" options:0 context:@"testCrazyKeyPathChanges2"];
|
||||
[a addObserver:self forKeyPath:@"b.c.d.e.f" options:CPKeyValueObservingOptionNew context:@"testCrazyKeyPathChanges2"];
|
||||
|
||||
[a setValue:nil forKeyPath:@"b.c"];
|
||||
|
||||
@@ -328,7 +357,7 @@
|
||||
[a setValue:[E new] forKeyPath:@"b.c.d.e"];
|
||||
[a setValue:[F new] forKeyPath:@"b.c.d.e.f"];
|
||||
|
||||
[a addObserver:self forKeyPath:@"b.c.d.e.f" options:0 context:@"testCrazyKeyPathChanges3"];
|
||||
[a addObserver:self forKeyPath:@"b.c.d.e.f" options:CPKeyValueObservingOptionNew context:@"testCrazyKeyPathChanges3"];
|
||||
|
||||
[a setValue:7 forKeyPath:@"b.c.d.e.f"];
|
||||
|
||||
@@ -341,7 +370,7 @@
|
||||
|
||||
[tester setValue:[1, 2, 3, 4] forKey:@"managedObjects"];
|
||||
|
||||
[tester addObserver:self forKeyPath:@"managedObjects" options:0 context:@"testInsertIntoToManyProperty"];
|
||||
[tester addObserver:self forKeyPath:@"managedObjects" options:CPKeyValueObservingOptionNew context:@"testInsertIntoToManyProperty"];
|
||||
|
||||
[tester insertObject:5 inManagedObjectsAtIndex:4];
|
||||
|
||||
@@ -354,7 +383,7 @@
|
||||
|
||||
[tester setValue:[1, 2, 3, 4] forKey:@"managedObjects"];
|
||||
|
||||
[tester addObserver:self forKeyPath:@"managedObjects" options:0 context:@"testRemoveFromToManyProperty"];
|
||||
[tester addObserver:self forKeyPath:@"managedObjects" options:CPKeyValueObservingOptionOld context:@"testRemoveFromToManyProperty"];
|
||||
|
||||
[tester removeObjectFromManagedObjectsAtIndex:0];
|
||||
|
||||
@@ -367,7 +396,7 @@
|
||||
|
||||
tester.tester = [ToManyTester new];
|
||||
[tester.tester setValue:[1, 2, 3, 4] forKey:@"managedObjects"];
|
||||
[tester addObserver:self forKeyPath:@"tester.managedObjects" options:0 context:@"testInsertIntoToManyPropertyIndirectly"];
|
||||
[tester addObserver:self forKeyPath:@"tester.managedObjects" options:CPKeyValueObservingOptionNew context:@"testInsertIntoToManyPropertyIndirectly"];
|
||||
|
||||
[tester.tester insertObject:5 inManagedObjectsAtIndex:4];
|
||||
|
||||
@@ -381,7 +410,7 @@
|
||||
tester.tester = [ToManyTester new];
|
||||
|
||||
[tester.tester setValue:[1, 2, 3, 4] forKey:@"subviews"];
|
||||
[tester addObserver:self forKeyPath:@"tester.subviews" options:0 context:@"testInsertIntoArrayPropertyIndirectly"];
|
||||
[tester addObserver:self forKeyPath:@"tester.subviews" options:CPKeyValueObservingOptionNew context:@"testInsertIntoArrayPropertyIndirectly"];
|
||||
|
||||
[tester.tester insertSubview:5 atIndex:4];
|
||||
|
||||
@@ -395,7 +424,7 @@
|
||||
tester.tester = [ToManyTester new];
|
||||
|
||||
[tester.tester setValue:[1, 2, 3, 4] forKey:@"subviews"];
|
||||
[tester addObserver:self forKeyPath:@"tester.subviews" options:0 context:@"testChangeTopLevelObject"];
|
||||
[tester addObserver:self forKeyPath:@"tester.subviews" options:CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld context:@"testChangeTopLevelObject"];
|
||||
|
||||
var newTesterTester = [ToManyTester new];
|
||||
[newTesterTester setValue:[5, 6, 7, 8] forKey:@"subviews"];
|
||||
@@ -554,7 +583,24 @@
|
||||
if (!_sawPriorObservation)
|
||||
{
|
||||
[self assertTrue:prior message:@"Have not been sent the prior notification, but it should have been sent"];
|
||||
[self assertTrue:oldValue == [CPNull null] message:@"Shoudl be no initial value"];
|
||||
[self assertTrue:oldValue == [CPNull null] message:@"Should be no initial value"];
|
||||
[self assertFalse:newValue message:@"Should be no object for the new value key on the prior notification"];
|
||||
_sawPriorObservation = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self assertFalse:prior message:@"there should be no value for the notification is prior key, that notification was already sent"];
|
||||
[self assertTrue:newValue == "set_bob" message:@"newValue should be: set_bob was: " + newValue];
|
||||
}
|
||||
break;
|
||||
|
||||
case "testPriorObservationOptionNoOld":
|
||||
var prior = [changes objectForKey:CPKeyValueChangeNotificationIsPriorKey];
|
||||
|
||||
if (!_sawPriorObservation)
|
||||
{
|
||||
[self assertTrue:prior message:@"Have not been sent the prior notification, but it should have been sent"];
|
||||
[self assertTrue:oldValue == nil message:@"Should be no old value"];
|
||||
[self assertFalse:newValue message:@"Should be no object for the new value key on the prior notification"];
|
||||
_sawPriorObservation = YES;
|
||||
}
|
||||
@@ -568,8 +614,20 @@
|
||||
case "testInitialObservationOption":
|
||||
if (!_sawInitialObservation)
|
||||
{
|
||||
[self assertTrue:newValue == "paul" message:@"Expected old value to be: paul was: " + oldValue];
|
||||
[self assertFalse:oldValue message:@"Should be no value for new change key on initial observation"];
|
||||
[self assertTrue:newValue == "paul" message:@"Expected new value to be: paul was: " + newValue];
|
||||
[self assertTrue:oldValue == nil message:@"Should be no value for old change key on initial observation"];
|
||||
_sawInitialObservation = YES;
|
||||
}
|
||||
else
|
||||
[self assertFalse:YES message:@"Should never have received this notification"];
|
||||
|
||||
break;
|
||||
|
||||
case "testInitialObservationOptionNoNew":
|
||||
if (!_sawInitialObservation)
|
||||
{
|
||||
[self assertTrue:newValue == nil message:@"New value should not be included"];
|
||||
[self assertTrue:oldValue == nil message:@"Should be no value for old change key on initial observation"];
|
||||
_sawInitialObservation = YES;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@import <Foundation/CPKeyValueCoding.j>
|
||||
@import <Foundation/CPKeyValueObserving.j>
|
||||
|
||||
var _getCheeseCounter;
|
||||
|
||||
@implementation CPKeyValueObservingTest : OJTestCase
|
||||
{
|
||||
@@ -9,6 +10,12 @@
|
||||
id _lastObject;
|
||||
CPDictionary _lastChange;
|
||||
id _lastContext;
|
||||
|
||||
CPString _secondLastKeyPath;
|
||||
id _secondLastObject;
|
||||
CPDictionary _secondLastChange;
|
||||
id _secondLastContext;
|
||||
|
||||
}
|
||||
|
||||
- (Class)objectWithMethods:(CPString)aMethodName, ...
|
||||
@@ -26,9 +33,10 @@
|
||||
return [theClass new];
|
||||
}
|
||||
|
||||
- (void)setup
|
||||
- (void)setUp
|
||||
{
|
||||
_lastKeyPath = _lastObject = _lastChange = _lastContext = nil;
|
||||
_lastKeyPath = _lastObject = _lastChange = _lastContext = _secondLastKeyPath = _secondLastObject = _secondLastChange = _secondLastContext = nil;
|
||||
_getCheeseCounter = 0;
|
||||
}
|
||||
|
||||
- (void)testInitialObserving
|
||||
@@ -38,18 +46,210 @@
|
||||
|
||||
[self assert:@"cheese" equals:_lastKeyPath];
|
||||
[self assert:tester equals:_lastObject];
|
||||
[self assert:[CPDictionary dictionaryWithObject:@"CHEESE!" forKey:CPKeyValueChangeNewKey] equals:_lastChange];
|
||||
[self assert:@{CPKeyValueChangeNewKey: @"CHEESE!", CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:_lastChange];
|
||||
[self assert:nil equals:_lastContext];
|
||||
}
|
||||
|
||||
- (void)testInitialObservingNoNew
|
||||
{
|
||||
var tester = [ObservingTester testerWithCheese:@"CHEESE!"];
|
||||
[tester addObserver:self forKeyPath:@"cheese" options:CPKeyValueObservingOptionInitial context:nil];
|
||||
|
||||
[self assert:@"cheese" equals:_lastKeyPath];
|
||||
[self assert:tester equals:_lastObject];
|
||||
[self assert:@{CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:_lastChange];
|
||||
[self assert:nil equals:_lastContext];
|
||||
}
|
||||
|
||||
- (void)testSettingObservingPrior
|
||||
{
|
||||
var tester = [ObservingTester testerWithCheese:@"CHEESE!"];
|
||||
[tester addObserver:self forKeyPath:@"cheese" options:CPKeyValueObservingOptionPrior context:nil];
|
||||
|
||||
[tester setValue:@"NEW CHEESE!" forKey:@"cheese"];
|
||||
|
||||
[self assert:@"cheese" equals:_secondLastKeyPath];
|
||||
[self assert:tester equals:_secondLastObject];
|
||||
[self assert:@{CPKeyValueChangeKindKey: CPKeyValueChangeSetting, CPKeyValueChangeNotificationIsPriorKey: 1} equals:_secondLastChange];
|
||||
[self assert:nil equals:_secondLastContext];
|
||||
|
||||
[self assert:@"cheese" equals:_lastKeyPath];
|
||||
[self assert:tester equals:_lastObject];
|
||||
[self assert:@{CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:_lastChange];
|
||||
[self assert:nil equals:_lastContext];
|
||||
[self assert:0 equals:_getCheeseCounter message:@"Get method should never be called"];
|
||||
}
|
||||
|
||||
- (void)testSettingObservingPriorPlusMoreObservers
|
||||
{
|
||||
var tester = [ObservingTester testerWithCheese:@"CHEESE!"];
|
||||
[tester addObserver:self forKeyPath:@"cheese" options:CPKeyValueObservingOptionPrior context:nil];
|
||||
|
||||
var observerWithOld = [[AnotherObserver alloc] init];
|
||||
[tester addObserver:observerWithOld forKeyPath:@"cheese" options:CPKeyValueObservingOptionPrior | CPKeyValueObservingOptionOld context:nil];
|
||||
|
||||
var observerWithNew = [[AnotherObserver alloc] init];
|
||||
[tester addObserver:observerWithNew forKeyPath:@"cheese" options:CPKeyValueObservingOptionPrior | CPKeyValueObservingOptionNew context:nil];
|
||||
|
||||
var observerWithNewAndOld = [[AnotherObserver alloc] init];
|
||||
[tester addObserver:observerWithNewAndOld forKeyPath:@"cheese" options:CPKeyValueObservingOptionPrior | CPKeyValueObservingOptionOld | CPKeyValueObservingOptionNew context:nil];
|
||||
|
||||
[tester setValue:@"NEW CHEESE!" forKey:@"cheese"];
|
||||
|
||||
[self assert:@"cheese" equals:_secondLastKeyPath];
|
||||
[self assert:tester equals:_secondLastObject];
|
||||
[self assert:@{CPKeyValueChangeKindKey: CPKeyValueChangeSetting, CPKeyValueChangeNotificationIsPriorKey: 1} equals:_secondLastChange];
|
||||
[self assert:nil equals:_secondLastContext];
|
||||
|
||||
[self assert:@"cheese" equals:_lastKeyPath];
|
||||
[self assert:tester equals:_lastObject];
|
||||
[self assert:@{CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:_lastChange];
|
||||
[self assert:nil equals:_lastContext];
|
||||
|
||||
[self assert:@"cheese" equals:observerWithOld._secondLastKeyPath];
|
||||
[self assert:tester equals:observerWithOld._secondLastObject];
|
||||
[self assert:@{CPKeyValueChangeOldKey: @"CHEESE!", CPKeyValueChangeKindKey: CPKeyValueChangeSetting, CPKeyValueChangeNotificationIsPriorKey: 1} equals:observerWithOld._secondLastChange];
|
||||
[self assert:nil equals:observerWithOld._secondLastContext];
|
||||
|
||||
[self assert:@"cheese" equals:observerWithOld._lastKeyPath];
|
||||
[self assert:tester equals:observerWithOld._lastObject];
|
||||
[self assert:@{CPKeyValueChangeOldKey: @"CHEESE!", CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:observerWithOld._lastChange];
|
||||
[self assert:nil equals:observerWithOld._lastContext];
|
||||
|
||||
[self assert:@"cheese" equals:observerWithNew._secondLastKeyPath];
|
||||
[self assert:tester equals:observerWithNew._secondLastObject];
|
||||
[self assert:@{CPKeyValueChangeKindKey: CPKeyValueChangeSetting, CPKeyValueChangeNotificationIsPriorKey: 1} equals:observerWithNew._secondLastChange];
|
||||
[self assert:nil equals:observerWithNew._secondLastContext];
|
||||
|
||||
[self assert:@"cheese" equals:observerWithNew._lastKeyPath];
|
||||
[self assert:tester equals:observerWithNew._lastObject];
|
||||
[self assert:@{CPKeyValueChangeNewKey: @"NEW CHEESE!", CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:observerWithNew._lastChange];
|
||||
[self assert:nil equals:observerWithNew._lastContext];
|
||||
|
||||
[self assert:@"cheese" equals:observerWithNewAndOld._secondLastKeyPath];
|
||||
[self assert:tester equals:observerWithNewAndOld._secondLastObject];
|
||||
[self assert:@{CPKeyValueChangeOldKey: @"CHEESE!", CPKeyValueChangeKindKey: CPKeyValueChangeSetting, CPKeyValueChangeNotificationIsPriorKey: 1} equals:observerWithNewAndOld._secondLastChange];
|
||||
[self assert:nil equals:observerWithNewAndOld._secondLastContext];
|
||||
|
||||
[self assert:@"cheese" equals:observerWithNewAndOld._lastKeyPath];
|
||||
[self assert:tester equals:observerWithNewAndOld._lastObject];
|
||||
[self assert:@{CPKeyValueChangeNewKey: @"NEW CHEESE!", CPKeyValueChangeOldKey: @"CHEESE!", CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:observerWithNewAndOld._lastChange];
|
||||
[self assert:nil equals:observerWithNewAndOld._lastContext];
|
||||
|
||||
[self assert:2 equals:_getCheeseCounter message:@"Get method should only be called twice, not " + _getCheeseCounter + " times"];
|
||||
}
|
||||
|
||||
- (void)testSettingObserving
|
||||
{
|
||||
var tester = [ObservingTester testerWithCheese:@"CHEESE!"];
|
||||
[tester addObserver:self forKeyPath:@"cheese" options:0 context:nil];
|
||||
|
||||
[tester setValue:@"NEW CHEESE!" forKey:@"cheese"];
|
||||
[self assert:@"cheese" equals:_lastKeyPath];
|
||||
[self assert:tester equals:_lastObject];
|
||||
[self assert:@{CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:_lastChange];
|
||||
[self assert:nil equals:_lastContext];
|
||||
[self assert:0 equals:_getCheeseCounter message:@"Get method should never be called"];
|
||||
}
|
||||
|
||||
- (void)testSettingObservingNewPlusAnotherObserverWithNoNew
|
||||
{
|
||||
var tester = [ObservingTester testerWithCheese:@"CHEESE!"];
|
||||
[tester addObserver:self forKeyPath:@"cheese" options:CPKeyValueObservingOptionNew context:nil];
|
||||
|
||||
var anotherObserver = [[AnotherObserver alloc] init];
|
||||
[tester addObserver:anotherObserver forKeyPath:@"cheese" options:0 context:nil];
|
||||
|
||||
[tester setValue:@"NEW CHEESE!" forKey:@"cheese"];
|
||||
|
||||
[self assert:@"cheese" equals:_lastKeyPath];
|
||||
[self assert:tester equals:_lastObject];
|
||||
[self assert:@{CPKeyValueChangeNewKey: @"NEW CHEESE!", CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:_lastChange];
|
||||
[self assert:nil equals:_lastContext];
|
||||
|
||||
[self assert:@"cheese" equals:anotherObserver._lastKeyPath];
|
||||
[self assert:tester equals:anotherObserver._lastObject];
|
||||
[self assert:@{CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:anotherObserver._lastChange];
|
||||
[self assert:nil equals:anotherObserver._lastContext];
|
||||
|
||||
[self assert:1 equals:_getCheeseCounter message:@"Get method should only be called once, not " + _getCheeseCounter + " times"];
|
||||
}
|
||||
|
||||
- (void)testSettingObservingOldPlusAnotherObserverWithNoOld
|
||||
{
|
||||
var tester = [ObservingTester testerWithCheese:@"CHEESE!"];
|
||||
[tester addObserver:self forKeyPath:@"cheese" options:CPKeyValueObservingOptionOld context:nil];
|
||||
|
||||
var anotherObserver = [[AnotherObserver alloc] init];
|
||||
[tester addObserver:anotherObserver forKeyPath:@"cheese" options:0 context:nil];
|
||||
|
||||
[tester setValue:@"NEW CHEESE!" forKey:@"cheese"];
|
||||
|
||||
[self assert:@"cheese" equals:_lastKeyPath];
|
||||
[self assert:tester equals:_lastObject];
|
||||
[self assert:@{CPKeyValueChangeOldKey: @"CHEESE!", CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:_lastChange];
|
||||
[self assert:nil equals:_lastContext];
|
||||
|
||||
[self assert:@"cheese" equals:anotherObserver._lastKeyPath];
|
||||
[self assert:tester equals:anotherObserver._lastObject];
|
||||
[self assert:@{CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:anotherObserver._lastChange];
|
||||
[self assert:nil equals:anotherObserver._lastContext];
|
||||
|
||||
[self assert:1 equals:_getCheeseCounter message:@"Get method should only be called once, not " + _getCheeseCounter + " times"];
|
||||
}
|
||||
|
||||
- (void)testSettingObservingNewAndOldPlusMoreObserversWithOnlyNewOrOld
|
||||
{
|
||||
var tester = [ObservingTester testerWithCheese:@"CHEESE!"];
|
||||
[tester addObserver:self forKeyPath:@"cheese" options:CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld context:nil];
|
||||
|
||||
var anotherObserver = [[AnotherObserver alloc] init];
|
||||
[tester addObserver:anotherObserver forKeyPath:@"cheese" options:CPKeyValueObservingOptionOld context:nil];
|
||||
|
||||
var yetAnotherObserver = [[AnotherObserver alloc] init];
|
||||
[tester addObserver:yetAnotherObserver forKeyPath:@"cheese" options:CPKeyValueObservingOptionNew context:nil];
|
||||
|
||||
var noNewOrOldObserver = [[AnotherObserver alloc] init];
|
||||
[tester addObserver:noNewOrOldObserver forKeyPath:@"cheese" options:0 context:nil];
|
||||
|
||||
[tester setValue:@"NEW CHEESE!" forKey:@"cheese"];
|
||||
|
||||
[self assert:@"cheese" equals:_lastKeyPath];
|
||||
[self assert:tester equals:_lastObject];
|
||||
[self assert:@{CPKeyValueChangeNewKey: @"NEW CHEESE!", CPKeyValueChangeOldKey: @"CHEESE!", CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:_lastChange];
|
||||
[self assert:nil equals:_lastContext];
|
||||
|
||||
[self assert:@"cheese" equals:anotherObserver._lastKeyPath];
|
||||
[self assert:tester equals:anotherObserver._lastObject];
|
||||
[self assert:@{CPKeyValueChangeOldKey: @"CHEESE!", CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:anotherObserver._lastChange];
|
||||
[self assert:nil equals:anotherObserver._lastContext];
|
||||
|
||||
[self assert:@"cheese" equals:yetAnotherObserver._lastKeyPath];
|
||||
[self assert:tester equals:yetAnotherObserver._lastObject];
|
||||
[self assert:@{CPKeyValueChangeNewKey: @"NEW CHEESE!", CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:yetAnotherObserver._lastChange];
|
||||
[self assert:nil equals:yetAnotherObserver._lastContext];
|
||||
|
||||
[self assert:@"cheese" equals:noNewOrOldObserver._lastKeyPath];
|
||||
[self assert:tester equals:noNewOrOldObserver._lastObject];
|
||||
[self assert:@{CPKeyValueChangeKindKey: CPKeyValueChangeSetting} equals:noNewOrOldObserver._lastChange];
|
||||
[self assert:nil equals:noNewOrOldObserver._lastContext];
|
||||
|
||||
[self assert:2 equals:_getCheeseCounter message:@"Get method should only be called twice even with many observers, not " + _getCheeseCounter + " times"];
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(CPString)aKeyPath
|
||||
ofObject:(id)anObject
|
||||
change:(CPDictionary)aChange
|
||||
context:(id)aContext
|
||||
{
|
||||
_secondLastKeyPath = _lastKeyPath;
|
||||
_secondLastObject = _lastObject;
|
||||
_secondLastChange = _lastChange;
|
||||
_secondLastContext = _lastContext;
|
||||
|
||||
_lastKeyPath = aKeyPath;
|
||||
_lastObject = anObject;
|
||||
_lastChange = aChange;
|
||||
_lastChange = [aChange copy];
|
||||
_lastContext = aContext;
|
||||
}
|
||||
|
||||
@@ -244,6 +444,7 @@
|
||||
|
||||
- (id)cheese
|
||||
{
|
||||
_getCheeseCounter++;
|
||||
return cheese;
|
||||
}
|
||||
|
||||
@@ -280,3 +481,34 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation AnotherObserver : CPObject
|
||||
{
|
||||
CPString _lastKeyPath;
|
||||
id _lastObject;
|
||||
CPDictionary _lastChange;
|
||||
id _lastContext;
|
||||
|
||||
CPString _secondLastKeyPath;
|
||||
id _secondLastObject;
|
||||
CPDictionary _secondLastChange;
|
||||
id _secondLastContext;
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(CPString)aKeyPath
|
||||
ofObject:(id)anObject
|
||||
change:(CPDictionary)aChange
|
||||
context:(id)aContext
|
||||
{
|
||||
_secondLastKeyPath = _lastKeyPath;
|
||||
_secondLastObject = _lastObject;
|
||||
_secondLastChange = _lastChange;
|
||||
_secondLastContext = _lastContext;
|
||||
|
||||
_lastKeyPath = aKeyPath;
|
||||
_lastObject = anObject;
|
||||
_lastChange = [aChange copy];
|
||||
_lastContext = aContext;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -572,4 +572,11 @@
|
||||
[self assertThrows:function () { [@"Objective-J" compare:[CPNull null]] }];
|
||||
}
|
||||
|
||||
- (void)testStripDiacritics
|
||||
{
|
||||
[self assert:[@"áa ée íi óo úu" stripDiacritics] equals:@"aa ee ii oo uu"];
|
||||
[self assert:[@"ÁA ÉE ÍI ÓO ÚU" stripDiacritics] equals:@"AA EE II OO UU"];
|
||||
[self assert:[@"Å Ã Ê í ö û" stripDiacritics] equals:@"A A E i o u"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -399,9 +399,6 @@
|
||||
|
||||
_returnCode = 77;
|
||||
[CPApp endSheet:[self window] returnCode:_returnCode];
|
||||
|
||||
if (orderOutAfter)
|
||||
[[self window] orderOut:nil];
|
||||
}
|
||||
|
||||
//
|
||||
@@ -519,7 +516,15 @@
|
||||
// test sheet chaining. it should be possible to start another sheet from didEndSheet,
|
||||
// but only if we orderOut: the sheet before we called endSheet: This is how cocoa works too.
|
||||
if (returnCode == 77)
|
||||
{
|
||||
var orderOutAfter = [_orderOutAfterCheckbox state];
|
||||
|
||||
if (orderOutAfter)
|
||||
[[self window] orderOut:self];
|
||||
|
||||
[self runSheetForWindow:parentWindow];
|
||||
}
|
||||
|
||||
//[self runAlertSheet:parentWindow];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* CPControlSize
|
||||
*
|
||||
* Created Christophe Serafin <christophe.serafin@gmail.com> You on August 11, 2014.
|
||||
* Copyright 2014, All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
@outlet CPWindow theWindow;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
// This is called when the application is done loading.
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
// This is called when the cib is done loading.
|
||||
// You can implement this method on any object instantiated from a Cib.
|
||||
// It's a useful hook for setting up current UI values, and other things.
|
||||
|
||||
// In this case, we want the window from Cib to become our full browser window
|
||||
[theWindow setFullPlatformWindow:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Main cib file base name</key>
|
||||
<string>MainMenu.cib</string>
|
||||
<key>CPBundleName</key>
|
||||
<string>CPControlSize</string>
|
||||
<key>CPBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CPHumanReadableCopyright</key>
|
||||
<string>Copyright © 2014, All rights reserved.</string>
|
||||
<key>CPDefaultTheme</key>
|
||||
<string>Aristo2</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* CPControlSize
|
||||
*
|
||||
* Created by You on August 11, 2014.
|
||||
* Copyright 2014, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
var ENV = require("system").env,
|
||||
FILE = require("file"),
|
||||
JAKE = require("jake"),
|
||||
task = JAKE.task,
|
||||
FileList = JAKE.FileList,
|
||||
app = require("cappuccino/jake").app,
|
||||
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
|
||||
OS = require("os"),
|
||||
projectName = "CPControlSize";
|
||||
|
||||
app (projectName, function(task)
|
||||
{
|
||||
ENV["OBJJ_INCLUDE_PATHS"] = "Frameworks";
|
||||
|
||||
if (configuration === "Debug")
|
||||
ENV["OBJJ_INCLUDE_PATHS"] = FILE.join(ENV["OBJJ_INCLUDE_PATHS"], configuration);
|
||||
|
||||
task.setBuildIntermediatesPath(FILE.join("Build", "CPControlSize.build", configuration));
|
||||
task.setBuildPath(FILE.join("Build", configuration));
|
||||
|
||||
task.setProductName("CPControlSize");
|
||||
task.setIdentifier("com.yourcompany.CPControlSize");
|
||||
task.setVersion("1.0");
|
||||
task.setAuthor("Your Company");
|
||||
task.setEmail("feedback @nospam@ yourcompany.com");
|
||||
task.setSummary("CPControlSize");
|
||||
task.setSources(new FileList("**/*.j").exclude(FILE.join("Build", "**")).exclude(FILE.join("Frameworks", "Source", "**")));
|
||||
task.setResources(new FileList("Resources/**"));
|
||||
task.setIndexFilePath("index.html");
|
||||
task.setInfoPlistPath("Info.plist");
|
||||
|
||||
if (configuration === "Debug")
|
||||
task.setCompilerFlags("-DDEBUG -g");
|
||||
else
|
||||
task.setCompilerFlags("-O");
|
||||
});
|
||||
|
||||
task ("default", [projectName], function()
|
||||
{
|
||||
printResults(configuration);
|
||||
});
|
||||
|
||||
task ("build", ["default"], function()
|
||||
{
|
||||
updateApplicationSize();
|
||||
});
|
||||
|
||||
task ("debug", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Debug";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("release", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Release";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("run", ["debug"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Debug", projectName, "index.html")]);
|
||||
});
|
||||
|
||||
task ("run-release", ["release"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Release", projectName, "index.html")]);
|
||||
});
|
||||
|
||||
task ("deploy", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Deployment", projectName));
|
||||
OS.system(["press", "-f", FILE.join("Build", "Release", projectName), FILE.join("Build", "Deployment", projectName)]);
|
||||
printResults("Deployment")
|
||||
});
|
||||
|
||||
task ("desktop", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Desktop", projectName));
|
||||
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", projectName), FILE.join("Build", "Desktop", projectName, "CPControlSize.app"));
|
||||
printResults("Desktop")
|
||||
});
|
||||
|
||||
task ("run-desktop", ["desktop"], function()
|
||||
{
|
||||
OS.system([FILE.join("Build", "Desktop", projectName, "CPControlSize.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||
});
|
||||
|
||||
function printResults(configuration)
|
||||
{
|
||||
print("----------------------------");
|
||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, projectName));
|
||||
print("----------------------------");
|
||||
}
|
||||
|
||||
function updateApplicationSize()
|
||||
{
|
||||
print("Calculating application file sizes...");
|
||||
|
||||
var contents = FILE.read(FILE.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), { charset:"UTF-8" }),
|
||||
format = CFPropertyList.sniffedFormatOfString(contents),
|
||||
plist = CFPropertyList.propertyListFromString(contents),
|
||||
totalBytes = {executable:0, data:0, mhtml:0};
|
||||
|
||||
// Get the size of all framework executables and sprite data
|
||||
var frameworksDir = "Frameworks";
|
||||
|
||||
if (ENV["CONFIGURATION"] === "Debug")
|
||||
frameworksDir = FILE.join(frameworksDir, "Debug");
|
||||
|
||||
var frameworks = FILE.list(frameworksDir);
|
||||
|
||||
frameworks.forEach(function(framework)
|
||||
{
|
||||
if (framework !== "Source")
|
||||
addBundleFileSizes(FILE.join(frameworksDir, framework), totalBytes);
|
||||
});
|
||||
|
||||
// Read in the default theme name, and attempt to get its size
|
||||
var themeName = plist.valueForKey("CPDefaultTheme") || "Aristo2",
|
||||
themePath = nil;
|
||||
|
||||
if (themeName === "Aristo" || themeName === "Aristo2")
|
||||
themePath = FILE.join(frameworksDir, "AppKit", "Resources", themeName + ".blend");
|
||||
else
|
||||
themePath = FILE.join("Frameworks", "Resources", themeName + ".blend");
|
||||
|
||||
if (FILE.isDirectory(themePath))
|
||||
addBundleFileSizes(themePath, totalBytes);
|
||||
|
||||
// Add sizes for the app
|
||||
addBundleFileSizes(FILE.join("Build", ENV["CONFIGURATION"], projectName), totalBytes);
|
||||
|
||||
print("Executables: " + totalBytes.executable + ", sprite data: " + totalBytes.data + ", total: " + (totalBytes.executable + totalBytes.data));
|
||||
|
||||
var dict = new CFMutableDictionary();
|
||||
|
||||
dict.setValueForKey("executable", totalBytes.executable);
|
||||
dict.setValueForKey("data", totalBytes.data);
|
||||
dict.setValueForKey("mhtml", totalBytes.mhtml);
|
||||
|
||||
plist.setValueForKey("CPApplicationSize", dict);
|
||||
|
||||
FILE.write(FILE.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
|
||||
}
|
||||
|
||||
function addBundleFileSizes(bundlePath, totalBytes)
|
||||
{
|
||||
var bundleName = FILE.basename(bundlePath),
|
||||
environment = bundleName === "Foundation" ? "Objj" : "Browser",
|
||||
bundlePath = FILE.join(bundlePath, environment + ".environment");
|
||||
|
||||
if (FILE.isDirectory(bundlePath))
|
||||
{
|
||||
var filename = bundleName + ".sj",
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, filename));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.executable += filePath.size();
|
||||
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, "dataURLs.txt"));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.data += filePath.size();
|
||||
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, "MHTMLData.txt"));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.mhtml += filePath.size();
|
||||
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, "MHTMLPaths.txt"));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.mhtml += filePath.size();
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,537 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment version="1050" identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
<connections>
|
||||
<outlet property="delegate" destination="450" id="451"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application"/>
|
||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="371">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="335" y="390" width="507" height="529"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
|
||||
<view key="contentView" id="372">
|
||||
<rect key="frame" x="0.0" y="0.0" width="507" height="529"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<popUpButton verticalHuggingPriority="750" id="x4W-un-0cD">
|
||||
<rect key="frame" x="34" y="457" width="75" height="26"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="twp-s2-LmJ">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" title="OtherViews" id="fcN-Dl-IQ8">
|
||||
<items>
|
||||
<menuItem title="Item 1" id="hrm-kY-Djl"/>
|
||||
<menuItem title="Item 2" id="vN5-gl-vNC"/>
|
||||
<menuItem title="Item 3" id="UBd-Gc-0Ky"/>
|
||||
</items>
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
<popUpButton verticalHuggingPriority="750" id="8xe-Ws-gbi">
|
||||
<rect key="frame" x="203" y="462" width="76" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="fnw-t6-xXN">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<menu key="menu" title="OtherViews" id="M83-F4-gI5">
|
||||
<items>
|
||||
<menuItem title="Item 1" id="9zU-LS-gn9"/>
|
||||
<menuItem title="Item 2" id="rCx-5v-XF6"/>
|
||||
<menuItem title="Item 3" id="fp3-dt-Bwk"/>
|
||||
</items>
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
<popUpButton verticalHuggingPriority="750" id="GrQ-cT-p98">
|
||||
<rect key="frame" x="374" y="469" width="73" height="15"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="oG3-q6-b8X">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
<menu key="menu" title="OtherViews" id="4Se-lq-nBs">
|
||||
<items>
|
||||
<menuItem title="Item 1" id="Vgs-PF-l1C"/>
|
||||
<menuItem title="Item 2" id="9Re-nD-oss"/>
|
||||
<menuItem title="Item 3" id="p8l-4o-Rh9"/>
|
||||
</items>
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
<textField verticalHuggingPriority="750" id="duZ-4B-IHi">
|
||||
<rect key="frame" x="36" y="419" width="96" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="uNM-6c-a5P">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" id="vYT-ma-Xce">
|
||||
<rect key="frame" x="206" y="423" width="96" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="FYM-U3-I2Q">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="BGc-LU-OEi">
|
||||
<rect key="frame" x="34" y="494" width="81" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Regular size" id="NcJ-HR-XZI">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="twC-Ez-Cvs">
|
||||
<rect key="frame" x="204" y="497" width="67" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Small size" id="6uG-ec-HEA">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="dCc-cq-MO7">
|
||||
<rect key="frame" x="373" y="500" width="60" height="11"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Mini size" id="mx4-66-yGt">
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" id="Baf-Et-cEO">
|
||||
<rect key="frame" x="375" y="426" width="96" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="8VU-QE-dZY">
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<datePicker verticalHuggingPriority="750" id="pNn-Yt-Kof">
|
||||
<rect key="frame" x="36" y="328" width="113" height="27"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<datePickerCell key="cell" borderStyle="bezel" alignment="left" id="T5R-AB-cuN">
|
||||
<font key="font" metaFont="system"/>
|
||||
<calendarDate key="date" timeIntervalSinceReferenceDate="-595929600" calendarFormat="%Y-%m-%d %H:%M:%S %z">
|
||||
<!--1982-02-12 08:00:00 -0800-->
|
||||
<timeZone key="timeZone" name="US/Pacific">
|
||||
<data key="data">
|
||||
VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAC5AAAABAAAABCepkign7sVkKCGKqChmveQ
|
||||
y4kaoNIj9HDSYSYQ1v50INiArZDa/tGg28CQENzes6DdqayQ3r6VoN+JjpDgnneg4WlwkOJ+WaDjSVKQ
|
||||
5F47oOUpNJDmR1gg5xJREOgnOiDo8jMQ6gccIOrSFRDr5v4g7LH3EO3G4CDukdkQ76/8oPBxuxDxj96g
|
||||
8n/BkPNvwKD0X6OQ9U+ioPY/hZD3L4Sg+CiiEPkPZqD6CIQQ+viDIPvoZhD82GUg/chIEP64RyD/qCoQ
|
||||
AJgpIAGIDBACeAsgA3EokARhJ6AFUQqQBkEJoAcw7JAHjUOgCRDOkAmtvyAK8LCQC+CvoAzZzRANwJGg
|
||||
DrmvEA+priAQmZEQEYmQIBJ5cxATaXIgFFlVEBVJVCAWOTcQFyk2IBgiU5AZCRggGgI1kBryNKAb4heQ
|
||||
HNIWoB3B+ZAesfigH6HbkCB2KyAhgb2QIlYNICNq2hAkNe8gJUq8ECYV0SAnKp4QJ/7toCkKgBAp3s+g
|
||||
KupiECu+saAs036QLZ6ToC6zYJAvfnWgMJNCkDFnkiAycySQM0d0IDRTBpA1J1YgNjLokDcHOCA4HAUQ
|
||||
OOcaIDn75xA6xvwgO9vJEDywGKA9u6sQPo/6oD+bjRBAb9ygQYSpkEJPvqBDZIuQRC+goEVEbZBF89Mg
|
||||
Ry2KEEfTtSBJDWwQSbOXIErtThBLnLOgTNZqkE18laBOtkyQT1x3oFCWLpBRPFmgUnYQkFMcO6BUVfKQ
|
||||
VPwdoFY11JBW5TogWB7xEFjFHCBZ/tMQWqT+IFvetRBchOAgXb6XEF5kwiBfnnkQYE3eoGGHlZBiLcCg
|
||||
Y2d3kGQNoqBlR1mQZe2EoGcnO5BnzWagaQcdkGmtSKBq5v+Qa5ZlIGzQHBBtdkcgbq/+EG9WKSBwj+AQ
|
||||
cTYLIHJvwhBzFe0gdE+kEHT/CaB2OMCQdt7roHgYopB4vs2gefiEkHqer6B72GaQfH6RoH24SJB+XnOg
|
||||
f5gqkAABAAECAwEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA
|
||||
</data>
|
||||
</timeZone>
|
||||
</calendarDate>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
</datePickerCell>
|
||||
</datePicker>
|
||||
<datePicker verticalHuggingPriority="750" id="WXE-xa-O7P">
|
||||
<rect key="frame" x="206" y="333" width="113" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<datePickerCell key="cell" controlSize="small" borderStyle="bezel" alignment="left" id="Qb0-X9-0KQ">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<calendarDate key="date" timeIntervalSinceReferenceDate="-595929600" calendarFormat="%Y-%m-%d %H:%M:%S %z">
|
||||
<!--1982-02-12 08:00:00 -0800-->
|
||||
<timeZone key="timeZone" name="US/Pacific">
|
||||
<data key="data">
|
||||
VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAC5AAAABAAAABCepkign7sVkKCGKqChmveQ
|
||||
y4kaoNIj9HDSYSYQ1v50INiArZDa/tGg28CQENzes6DdqayQ3r6VoN+JjpDgnneg4WlwkOJ+WaDjSVKQ
|
||||
5F47oOUpNJDmR1gg5xJREOgnOiDo8jMQ6gccIOrSFRDr5v4g7LH3EO3G4CDukdkQ76/8oPBxuxDxj96g
|
||||
8n/BkPNvwKD0X6OQ9U+ioPY/hZD3L4Sg+CiiEPkPZqD6CIQQ+viDIPvoZhD82GUg/chIEP64RyD/qCoQ
|
||||
AJgpIAGIDBACeAsgA3EokARhJ6AFUQqQBkEJoAcw7JAHjUOgCRDOkAmtvyAK8LCQC+CvoAzZzRANwJGg
|
||||
DrmvEA+priAQmZEQEYmQIBJ5cxATaXIgFFlVEBVJVCAWOTcQFyk2IBgiU5AZCRggGgI1kBryNKAb4heQ
|
||||
HNIWoB3B+ZAesfigH6HbkCB2KyAhgb2QIlYNICNq2hAkNe8gJUq8ECYV0SAnKp4QJ/7toCkKgBAp3s+g
|
||||
KupiECu+saAs036QLZ6ToC6zYJAvfnWgMJNCkDFnkiAycySQM0d0IDRTBpA1J1YgNjLokDcHOCA4HAUQ
|
||||
OOcaIDn75xA6xvwgO9vJEDywGKA9u6sQPo/6oD+bjRBAb9ygQYSpkEJPvqBDZIuQRC+goEVEbZBF89Mg
|
||||
Ry2KEEfTtSBJDWwQSbOXIErtThBLnLOgTNZqkE18laBOtkyQT1x3oFCWLpBRPFmgUnYQkFMcO6BUVfKQ
|
||||
VPwdoFY11JBW5TogWB7xEFjFHCBZ/tMQWqT+IFvetRBchOAgXb6XEF5kwiBfnnkQYE3eoGGHlZBiLcCg
|
||||
Y2d3kGQNoqBlR1mQZe2EoGcnO5BnzWagaQcdkGmtSKBq5v+Qa5ZlIGzQHBBtdkcgbq/+EG9WKSBwj+AQ
|
||||
cTYLIHJvwhBzFe0gdE+kEHT/CaB2OMCQdt7roHgYopB4vs2gefiEkHqer6B72GaQfH6RoH24SJB+XnOg
|
||||
f5gqkAABAAECAwEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA
|
||||
</data>
|
||||
</timeZone>
|
||||
</calendarDate>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
</datePickerCell>
|
||||
</datePicker>
|
||||
<datePicker verticalHuggingPriority="750" id="WeD-S8-Zxs">
|
||||
<rect key="frame" x="375" y="338" width="113" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<datePickerCell key="cell" controlSize="mini" borderStyle="bezel" alignment="left" id="635-rQ-aDe">
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
<calendarDate key="date" timeIntervalSinceReferenceDate="-595929600" calendarFormat="%Y-%m-%d %H:%M:%S %z">
|
||||
<!--1982-02-12 08:00:00 -0800-->
|
||||
<timeZone key="timeZone" name="US/Pacific">
|
||||
<data key="data">
|
||||
VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAC5AAAABAAAABCepkign7sVkKCGKqChmveQ
|
||||
y4kaoNIj9HDSYSYQ1v50INiArZDa/tGg28CQENzes6DdqayQ3r6VoN+JjpDgnneg4WlwkOJ+WaDjSVKQ
|
||||
5F47oOUpNJDmR1gg5xJREOgnOiDo8jMQ6gccIOrSFRDr5v4g7LH3EO3G4CDukdkQ76/8oPBxuxDxj96g
|
||||
8n/BkPNvwKD0X6OQ9U+ioPY/hZD3L4Sg+CiiEPkPZqD6CIQQ+viDIPvoZhD82GUg/chIEP64RyD/qCoQ
|
||||
AJgpIAGIDBACeAsgA3EokARhJ6AFUQqQBkEJoAcw7JAHjUOgCRDOkAmtvyAK8LCQC+CvoAzZzRANwJGg
|
||||
DrmvEA+priAQmZEQEYmQIBJ5cxATaXIgFFlVEBVJVCAWOTcQFyk2IBgiU5AZCRggGgI1kBryNKAb4heQ
|
||||
HNIWoB3B+ZAesfigH6HbkCB2KyAhgb2QIlYNICNq2hAkNe8gJUq8ECYV0SAnKp4QJ/7toCkKgBAp3s+g
|
||||
KupiECu+saAs036QLZ6ToC6zYJAvfnWgMJNCkDFnkiAycySQM0d0IDRTBpA1J1YgNjLokDcHOCA4HAUQ
|
||||
OOcaIDn75xA6xvwgO9vJEDywGKA9u6sQPo/6oD+bjRBAb9ygQYSpkEJPvqBDZIuQRC+goEVEbZBF89Mg
|
||||
Ry2KEEfTtSBJDWwQSbOXIErtThBLnLOgTNZqkE18laBOtkyQT1x3oFCWLpBRPFmgUnYQkFMcO6BUVfKQ
|
||||
VPwdoFY11JBW5TogWB7xEFjFHCBZ/tMQWqT+IFvetRBchOAgXb6XEF5kwiBfnnkQYE3eoGGHlZBiLcCg
|
||||
Y2d3kGQNoqBlR1mQZe2EoGcnO5BnzWagaQcdkGmtSKBq5v+Qa5ZlIGzQHBBtdkcgbq/+EG9WKSBwj+AQ
|
||||
cTYLIHJvwhBzFe0gdE+kEHT/CaB2OMCQdt7roHgYopB4vs2gefiEkHqer6B72GaQfH6RoH24SJB+XnOg
|
||||
f5gqkAABAAECAwEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA
|
||||
</data>
|
||||
</timeZone>
|
||||
</calendarDate>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
</datePickerCell>
|
||||
</datePicker>
|
||||
<datePicker verticalHuggingPriority="750" id="ULi-zW-Q5q">
|
||||
<rect key="frame" x="36" y="281" width="113" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<datePickerCell key="cell" borderStyle="bezel" alignment="left" datePickerStyle="textField" id="RCm-sN-nrQ">
|
||||
<font key="font" metaFont="system"/>
|
||||
<calendarDate key="date" timeIntervalSinceReferenceDate="-595929600" calendarFormat="%Y-%m-%d %H:%M:%S %z">
|
||||
<!--1982-02-12 08:00:00 -0800-->
|
||||
<timeZone key="timeZone" name="US/Pacific">
|
||||
<data key="data">
|
||||
VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAC5AAAABAAAABCepkign7sVkKCGKqChmveQ
|
||||
y4kaoNIj9HDSYSYQ1v50INiArZDa/tGg28CQENzes6DdqayQ3r6VoN+JjpDgnneg4WlwkOJ+WaDjSVKQ
|
||||
5F47oOUpNJDmR1gg5xJREOgnOiDo8jMQ6gccIOrSFRDr5v4g7LH3EO3G4CDukdkQ76/8oPBxuxDxj96g
|
||||
8n/BkPNvwKD0X6OQ9U+ioPY/hZD3L4Sg+CiiEPkPZqD6CIQQ+viDIPvoZhD82GUg/chIEP64RyD/qCoQ
|
||||
AJgpIAGIDBACeAsgA3EokARhJ6AFUQqQBkEJoAcw7JAHjUOgCRDOkAmtvyAK8LCQC+CvoAzZzRANwJGg
|
||||
DrmvEA+priAQmZEQEYmQIBJ5cxATaXIgFFlVEBVJVCAWOTcQFyk2IBgiU5AZCRggGgI1kBryNKAb4heQ
|
||||
HNIWoB3B+ZAesfigH6HbkCB2KyAhgb2QIlYNICNq2hAkNe8gJUq8ECYV0SAnKp4QJ/7toCkKgBAp3s+g
|
||||
KupiECu+saAs036QLZ6ToC6zYJAvfnWgMJNCkDFnkiAycySQM0d0IDRTBpA1J1YgNjLokDcHOCA4HAUQ
|
||||
OOcaIDn75xA6xvwgO9vJEDywGKA9u6sQPo/6oD+bjRBAb9ygQYSpkEJPvqBDZIuQRC+goEVEbZBF89Mg
|
||||
Ry2KEEfTtSBJDWwQSbOXIErtThBLnLOgTNZqkE18laBOtkyQT1x3oFCWLpBRPFmgUnYQkFMcO6BUVfKQ
|
||||
VPwdoFY11JBW5TogWB7xEFjFHCBZ/tMQWqT+IFvetRBchOAgXb6XEF5kwiBfnnkQYE3eoGGHlZBiLcCg
|
||||
Y2d3kGQNoqBlR1mQZe2EoGcnO5BnzWagaQcdkGmtSKBq5v+Qa5ZlIGzQHBBtdkcgbq/+EG9WKSBwj+AQ
|
||||
cTYLIHJvwhBzFe0gdE+kEHT/CaB2OMCQdt7roHgYopB4vs2gefiEkHqer6B72GaQfH6RoH24SJB+XnOg
|
||||
f5gqkAABAAECAwEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA
|
||||
</data>
|
||||
</timeZone>
|
||||
</calendarDate>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
</datePickerCell>
|
||||
</datePicker>
|
||||
<datePicker verticalHuggingPriority="750" id="fx1-CP-l9m">
|
||||
<rect key="frame" x="206" y="285" width="113" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<datePickerCell key="cell" controlSize="small" borderStyle="bezel" alignment="left" datePickerStyle="textField" id="0fE-Wg-6b6">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<calendarDate key="date" timeIntervalSinceReferenceDate="-595929600" calendarFormat="%Y-%m-%d %H:%M:%S %z">
|
||||
<!--1982-02-12 08:00:00 -0800-->
|
||||
<timeZone key="timeZone" name="US/Pacific">
|
||||
<data key="data">
|
||||
VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAC5AAAABAAAABCepkign7sVkKCGKqChmveQ
|
||||
y4kaoNIj9HDSYSYQ1v50INiArZDa/tGg28CQENzes6DdqayQ3r6VoN+JjpDgnneg4WlwkOJ+WaDjSVKQ
|
||||
5F47oOUpNJDmR1gg5xJREOgnOiDo8jMQ6gccIOrSFRDr5v4g7LH3EO3G4CDukdkQ76/8oPBxuxDxj96g
|
||||
8n/BkPNvwKD0X6OQ9U+ioPY/hZD3L4Sg+CiiEPkPZqD6CIQQ+viDIPvoZhD82GUg/chIEP64RyD/qCoQ
|
||||
AJgpIAGIDBACeAsgA3EokARhJ6AFUQqQBkEJoAcw7JAHjUOgCRDOkAmtvyAK8LCQC+CvoAzZzRANwJGg
|
||||
DrmvEA+priAQmZEQEYmQIBJ5cxATaXIgFFlVEBVJVCAWOTcQFyk2IBgiU5AZCRggGgI1kBryNKAb4heQ
|
||||
HNIWoB3B+ZAesfigH6HbkCB2KyAhgb2QIlYNICNq2hAkNe8gJUq8ECYV0SAnKp4QJ/7toCkKgBAp3s+g
|
||||
KupiECu+saAs036QLZ6ToC6zYJAvfnWgMJNCkDFnkiAycySQM0d0IDRTBpA1J1YgNjLokDcHOCA4HAUQ
|
||||
OOcaIDn75xA6xvwgO9vJEDywGKA9u6sQPo/6oD+bjRBAb9ygQYSpkEJPvqBDZIuQRC+goEVEbZBF89Mg
|
||||
Ry2KEEfTtSBJDWwQSbOXIErtThBLnLOgTNZqkE18laBOtkyQT1x3oFCWLpBRPFmgUnYQkFMcO6BUVfKQ
|
||||
VPwdoFY11JBW5TogWB7xEFjFHCBZ/tMQWqT+IFvetRBchOAgXb6XEF5kwiBfnnkQYE3eoGGHlZBiLcCg
|
||||
Y2d3kGQNoqBlR1mQZe2EoGcnO5BnzWagaQcdkGmtSKBq5v+Qa5ZlIGzQHBBtdkcgbq/+EG9WKSBwj+AQ
|
||||
cTYLIHJvwhBzFe0gdE+kEHT/CaB2OMCQdt7roHgYopB4vs2gefiEkHqer6B72GaQfH6RoH24SJB+XnOg
|
||||
f5gqkAABAAECAwEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA
|
||||
</data>
|
||||
</timeZone>
|
||||
</calendarDate>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
</datePickerCell>
|
||||
</datePicker>
|
||||
<datePicker verticalHuggingPriority="750" id="dwU-8f-1Ek">
|
||||
<rect key="frame" x="375" y="287" width="110" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<datePickerCell key="cell" controlSize="mini" borderStyle="bezel" alignment="left" datePickerStyle="textField" id="O65-rh-JeL">
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
<calendarDate key="date" timeIntervalSinceReferenceDate="-595929600" calendarFormat="%Y-%m-%d %H:%M:%S %z">
|
||||
<!--1982-02-12 08:00:00 -0800-->
|
||||
<timeZone key="timeZone" name="US/Pacific">
|
||||
<data key="data">
|
||||
VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAC5AAAABAAAABCepkign7sVkKCGKqChmveQ
|
||||
y4kaoNIj9HDSYSYQ1v50INiArZDa/tGg28CQENzes6DdqayQ3r6VoN+JjpDgnneg4WlwkOJ+WaDjSVKQ
|
||||
5F47oOUpNJDmR1gg5xJREOgnOiDo8jMQ6gccIOrSFRDr5v4g7LH3EO3G4CDukdkQ76/8oPBxuxDxj96g
|
||||
8n/BkPNvwKD0X6OQ9U+ioPY/hZD3L4Sg+CiiEPkPZqD6CIQQ+viDIPvoZhD82GUg/chIEP64RyD/qCoQ
|
||||
AJgpIAGIDBACeAsgA3EokARhJ6AFUQqQBkEJoAcw7JAHjUOgCRDOkAmtvyAK8LCQC+CvoAzZzRANwJGg
|
||||
DrmvEA+priAQmZEQEYmQIBJ5cxATaXIgFFlVEBVJVCAWOTcQFyk2IBgiU5AZCRggGgI1kBryNKAb4heQ
|
||||
HNIWoB3B+ZAesfigH6HbkCB2KyAhgb2QIlYNICNq2hAkNe8gJUq8ECYV0SAnKp4QJ/7toCkKgBAp3s+g
|
||||
KupiECu+saAs036QLZ6ToC6zYJAvfnWgMJNCkDFnkiAycySQM0d0IDRTBpA1J1YgNjLokDcHOCA4HAUQ
|
||||
OOcaIDn75xA6xvwgO9vJEDywGKA9u6sQPo/6oD+bjRBAb9ygQYSpkEJPvqBDZIuQRC+goEVEbZBF89Mg
|
||||
Ry2KEEfTtSBJDWwQSbOXIErtThBLnLOgTNZqkE18laBOtkyQT1x3oFCWLpBRPFmgUnYQkFMcO6BUVfKQ
|
||||
VPwdoFY11JBW5TogWB7xEFjFHCBZ/tMQWqT+IFvetRBchOAgXb6XEF5kwiBfnnkQYE3eoGGHlZBiLcCg
|
||||
Y2d3kGQNoqBlR1mQZe2EoGcnO5BnzWagaQcdkGmtSKBq5v+Qa5ZlIGzQHBBtdkcgbq/+EG9WKSBwj+AQ
|
||||
cTYLIHJvwhBzFe0gdE+kEHT/CaB2OMCQdt7roHgYopB4vs2gefiEkHqer6B72GaQfH6RoH24SJB+XnOg
|
||||
f5gqkAABAAECAwEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA
|
||||
AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA
|
||||
</data>
|
||||
</timeZone>
|
||||
</calendarDate>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
</datePickerCell>
|
||||
</datePicker>
|
||||
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="Pf5-bX-XNM">
|
||||
<rect key="frame" x="33" y="374" width="19" height="27"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<stepperCell key="cell" continuous="YES" alignment="left" maxValue="100" id="UBb-vf-dHD"/>
|
||||
</stepper>
|
||||
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="fX5-Cx-kra">
|
||||
<rect key="frame" x="204" y="381" width="15" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" maxValue="100" id="s3t-dy-wPz"/>
|
||||
</stepper>
|
||||
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="eJ6-cs-745">
|
||||
<rect key="frame" x="373" y="388" width="13" height="15"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<stepperCell key="cell" controlSize="mini" continuous="YES" alignment="left" maxValue="100" id="RqJ-YK-TXI"/>
|
||||
</stepper>
|
||||
<button verticalHuggingPriority="750" id="qeW-JF-8PA">
|
||||
<rect key="frame" x="30" y="192" width="82" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="r33-XP-TYJ">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="bUw-8W-83b">
|
||||
<rect key="frame" x="201" y="196" width="82" height="28"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="iFL-tR-EKi">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="mtR-eh-GXS">
|
||||
<rect key="frame" x="374" y="204" width="82" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" controlSize="mini" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Ebs-LH-Vnq">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button id="utt-sX-YI9">
|
||||
<rect key="frame" x="34" y="238" width="81" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="plS-mh-316">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button id="5tT-da-cbF">
|
||||
<rect key="frame" x="203" y="237" width="75" height="20"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="OGk-WN-tAu">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button id="wmA-RV-jeJ">
|
||||
<rect key="frame" x="371" y="237" width="63" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="left" controlSize="mini" inset="2" id="ro6-1L-HbO">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="OuO-8D-Jv1">
|
||||
<rect key="frame" x="36" y="155" width="110" height="25"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="squareTextured" title="Textured Button" bezelStyle="texturedSquare" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="SNT-aA-bDy">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="eG9-13-wdi">
|
||||
<rect key="frame" x="206" y="160" width="110" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="squareTextured" title="Textured Button" bezelStyle="texturedSquare" imagePosition="overlaps" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="xJm-nS-cPR">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="7FL-7D-m2j">
|
||||
<rect key="frame" x="375" y="163" width="110" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="squareTextured" title="Textured Button" bezelStyle="texturedSquare" imagePosition="overlaps" alignment="center" controlSize="mini" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="np3-qE-wIc">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="pqa-mo-oK1">
|
||||
<rect key="frame" x="36" y="117" width="115" height="25"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="roundTextured" title="Round Textured" bezelStyle="texturedRounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="rpo-yw-hd8">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="Mv6-Iy-X4h">
|
||||
<rect key="frame" x="206" y="122" width="115" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="roundTextured" title="Round Textured" bezelStyle="texturedRounded" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="PQW-Lc-Dm5">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="O3l-BH-NXK">
|
||||
<rect key="frame" x="375" y="125" width="115" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="roundTextured" title="Round Textured" bezelStyle="texturedRounded" alignment="center" controlSize="mini" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="fzh-RR-war">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<matrix verticalHuggingPriority="750" allowsEmptySelection="NO" autorecalculatesCellSize="YES" id="eUQ-61-gJI">
|
||||
<rect key="frame" x="36" y="67" width="70" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
<size key="cellSize" width="70" height="21"/>
|
||||
<size key="intercellSpacing" width="4" height="2"/>
|
||||
<buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" inset="2" id="b9B-FK-ORL">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<cells>
|
||||
<column>
|
||||
<buttonCell type="radio" title="Radio" imagePosition="left" alignment="left" state="on" tag="1" inset="2" id="yPV-N3-l7E">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<buttonCell type="radio" title="Radio" imagePosition="left" alignment="left" inset="2" id="Cqa-N2-FKj">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</column>
|
||||
</cells>
|
||||
</matrix>
|
||||
<matrix verticalHuggingPriority="750" allowsEmptySelection="NO" autorecalculatesCellSize="YES" id="IGX-cm-xbF">
|
||||
<rect key="frame" x="206" y="73" width="63" height="38"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
<size key="cellSize" width="63" height="18"/>
|
||||
<size key="intercellSpacing" width="4" height="2"/>
|
||||
<buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" controlSize="small" inset="2" id="Wc0-ah-hD0">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
<cells>
|
||||
<column>
|
||||
<buttonCell type="radio" title="Radio" imagePosition="left" alignment="left" controlSize="small" state="on" tag="1" inset="2" id="maf-wx-fVJ">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
<buttonCell type="radio" title="Radio" imagePosition="left" alignment="left" controlSize="small" inset="2" id="rxl-U7-ML4">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
</column>
|
||||
</cells>
|
||||
</matrix>
|
||||
<matrix verticalHuggingPriority="750" allowsEmptySelection="NO" autorecalculatesCellSize="YES" id="SLm-Fm-NnP">
|
||||
<rect key="frame" x="375" y="73" width="57" height="38"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
<size key="cellSize" width="57" height="18"/>
|
||||
<size key="intercellSpacing" width="4" height="2"/>
|
||||
<buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" controlSize="mini" inset="2" id="CQl-UO-ilA">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
</buttonCell>
|
||||
<cells>
|
||||
<column>
|
||||
<buttonCell type="radio" title="Radio" imagePosition="left" alignment="left" controlSize="mini" state="on" tag="1" inset="2" id="9IN-el-UsO">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
</buttonCell>
|
||||
<buttonCell type="radio" title="Radio" imagePosition="left" alignment="left" controlSize="mini" inset="2" id="4PO-03-gDn">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
</buttonCell>
|
||||
</column>
|
||||
</cells>
|
||||
</matrix>
|
||||
<comboBox verticalHuggingPriority="750" id="yfb-qa-Ypy">
|
||||
<rect key="frame" x="36" y="35" width="99" height="26"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" completes="NO" numberOfVisibleItems="5" id="7lM-32-tfT">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</comboBoxCell>
|
||||
</comboBox>
|
||||
<comboBox verticalHuggingPriority="750" id="aGP-Sw-SGa">
|
||||
<rect key="frame" x="206" y="38" width="99" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<comboBoxCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" completes="NO" numberOfVisibleItems="5" id="1HS-Qg-oau">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</comboBoxCell>
|
||||
</comboBox>
|
||||
<comboBox verticalHuggingPriority="750" id="Sub-ME-hYL">
|
||||
<rect key="frame" x="375" y="41" width="99" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<comboBoxCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" completes="NO" numberOfVisibleItems="5" id="6Ao-lo-5FY">
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</comboBoxCell>
|
||||
</comboBox>
|
||||
</subviews>
|
||||
</view>
|
||||
</window>
|
||||
<customObject id="450" customClass="AppController">
|
||||
<connections>
|
||||
<outlet property="theWindow" destination="371" id="459"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,191 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!--
|
||||
index-debug.html
|
||||
CPControlSize
|
||||
|
||||
Created by You on August 11, 2014.
|
||||
Copyright 2014, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!--[if lte IE 8]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1">
|
||||
<![endif]-->
|
||||
<!--[if gte IE 9]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
|
||||
<![endif]-->
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png">
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png">
|
||||
|
||||
<title>CPControlSize</title>
|
||||
|
||||
<!-- Custom javascript goes here -->
|
||||
<!-- End custom javascript -->
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks"];
|
||||
|
||||
var progressBar = null;
|
||||
|
||||
OBJJ_PROGRESS_CALLBACK = function(percent, appSize, path)
|
||||
{
|
||||
percent = percent * 100;
|
||||
|
||||
if (!progressBar)
|
||||
progressBar = document.getElementById("progress-bar");
|
||||
|
||||
if (progressBar)
|
||||
progressBar.style.width = Math.min(percent, 100) + "%";
|
||||
}
|
||||
|
||||
var loadingHTML =
|
||||
'<div id="loading">' +
|
||||
' <div id="loading-text">Loading...</div>' +
|
||||
' <div id="progress-indicator">' +
|
||||
' <span id="progress-bar" style="width:0%"></span>' +
|
||||
' </div>' +
|
||||
'</div>';
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
|
||||
// DEBUG OPTIONS:
|
||||
|
||||
// Uncomment to enable printing of backtraces on exceptions:
|
||||
//objj_msgSend_decorate(objj_backtrace_decorator);
|
||||
|
||||
// Uncomment to supress exceptions that take place inside a message
|
||||
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
|
||||
|
||||
// Uncomment to enable runtime type checking:
|
||||
//objj_msgSend_decorate(objj_typecheck_decorator);
|
||||
|
||||
// Uncomment (along with both above) to print backtraces on type check errors:
|
||||
//objj_typecheck_prints_backtrace = true;
|
||||
|
||||
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
|
||||
//CPLogUnregister(CPLogDefault);
|
||||
|
||||
// Uncomment to enable a specific logger:
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
|
||||
// Tag view DOM elements with a "data-cappuccino-view" attribute that contains
|
||||
// the class name of the view that created them. Comment this or set to false to disable.
|
||||
appkit_tag_dom_elements = true;
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
html, body, h1, p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* We need a body wrapper because Cappuccino is unhappy if we change the body element */
|
||||
#cappuccino-body {
|
||||
/* Position it absolutely so it will fill the height without content */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
|
||||
/* Put it at the bottom of the stack so it doesn't interfere with UI */
|
||||
z-index: -1000;
|
||||
}
|
||||
|
||||
#cappuccino-body .container {
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#cappuccino-body .content {
|
||||
display: table-cell;
|
||||
height: 100%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#loading {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
}
|
||||
|
||||
#loading-text {
|
||||
height: 1.5em;
|
||||
color: #555;
|
||||
font: normal bold 36px/36px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#progress-indicator {
|
||||
padding: 0px;
|
||||
height: 16px;
|
||||
border: 5px solid #555;
|
||||
border-radius: 18px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#progress-bar {
|
||||
position: relative;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
display: block;
|
||||
height: 18px;
|
||||
|
||||
/* Compensate for moving the bar left 1px to overlap the indicator border */
|
||||
border-right: 1px solid #555;
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
#noscript {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
padding: 1em 1.5em;
|
||||
border: 5px solid #555;
|
||||
border-radius: 16px;
|
||||
background-color: white;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
font: bold 24px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#noscript a {
|
||||
color: #98c0ff;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="cappuccino-body">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<script type="text/javascript">
|
||||
document.write(loadingHTML);
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<noscript style="position:absolute; top:0; left:0; width:100%; height:100%">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<div id="noscript">
|
||||
<p style="font-size:120%; margin-bottom:.75em">JavaScript is required for this site.</p>
|
||||
<p><a href="http://www.enable-javascript.com" target="_blank">Enable JavaScript</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,161 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!--
|
||||
index.html
|
||||
CPControlSize
|
||||
|
||||
Created by You on August 11, 2014.
|
||||
Copyright 2014, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!--[if lte IE 8]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1">
|
||||
<![endif]-->
|
||||
<!--[if gte IE 9]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
|
||||
<![endif]-->
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png">
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png">
|
||||
|
||||
<title>CPControlSize</title>
|
||||
|
||||
<!-- Custom javascript goes here -->
|
||||
<!-- End custom javascript -->
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
|
||||
var progressBar = null;
|
||||
|
||||
OBJJ_PROGRESS_CALLBACK = function(percent, appSize, path)
|
||||
{
|
||||
percent = percent * 100;
|
||||
|
||||
if (!progressBar)
|
||||
progressBar = document.getElementById("progress-bar");
|
||||
|
||||
if (progressBar)
|
||||
progressBar.style.width = Math.min(percent, 100) + "%";
|
||||
}
|
||||
|
||||
var loadingHTML =
|
||||
'<div id="loading">' +
|
||||
' <div id="loading-text">Loading...</div>' +
|
||||
' <div id="progress-indicator">' +
|
||||
' <span id="progress-bar" style="width:0%"></span>' +
|
||||
' </div>' +
|
||||
'</div>';
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<style type="text/css">
|
||||
html, body, h1, p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* We need a body wrapper because Cappuccino is unhappy if we change the body element */
|
||||
#cappuccino-body {
|
||||
/* Position it absolutely so it will fill the height without content */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
|
||||
/* Put it at the bottom of the stack so it doesn't interfere with UI */
|
||||
z-index: -1000;
|
||||
}
|
||||
|
||||
#cappuccino-body .container {
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#cappuccino-body .content {
|
||||
display: table-cell;
|
||||
height: 100%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#loading {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
}
|
||||
|
||||
#loading-text {
|
||||
height: 1.5em;
|
||||
color: #555;
|
||||
font: normal bold 36px/36px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#progress-indicator {
|
||||
padding: 0px;
|
||||
height: 16px;
|
||||
border: 5px solid #555;
|
||||
border-radius: 18px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#progress-bar {
|
||||
position: relative;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
display: block;
|
||||
height: 18px;
|
||||
|
||||
/* Compensate for moving the bar left 1px to overlap the indicator border */
|
||||
border-right: 1px solid #555;
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
#noscript {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
padding: 1em 1.5em;
|
||||
border: 5px solid #555;
|
||||
border-radius: 16px;
|
||||
background-color: white;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
font: bold 24px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#noscript a {
|
||||
color: #98c0ff;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="cappuccino-body">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<script type="text/javascript">
|
||||
document.write(loadingHTML);
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<noscript style="position:absolute; top:0; left:0; width:100%; height:100%">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<div id="noscript">
|
||||
<p style="font-size:120%; margin-bottom:.75em">JavaScript is required for this site.</p>
|
||||
<p><a href="http://www.enable-javascript.com" target="_blank">Enable JavaScript</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* CPControlSize
|
||||
*
|
||||
* Created by You on August 11, 2014.
|
||||
* Copyright 2014, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "AppController.j"
|
||||
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -61,12 +61,12 @@ var randomFromTo = function(from, to)
|
||||
[recordField setObjectValue:record];
|
||||
}
|
||||
|
||||
- (void)setDate1:(id)sender
|
||||
- (@action)setDate1:(id)sender
|
||||
{
|
||||
[self setDate:dateField1];
|
||||
}
|
||||
|
||||
- (void)setDate2:(id)sender
|
||||
- (@action)setDate2:(id)sender
|
||||
{
|
||||
[self setDate:dateField2];
|
||||
}
|
||||
@@ -78,26 +78,71 @@ var randomFromTo = function(from, to)
|
||||
[field setObjectValue:date];
|
||||
}
|
||||
|
||||
- (void)objectValue1:(id)sender
|
||||
- (@action)objectValue1:(id)sender
|
||||
{
|
||||
CPLog.info("Date 1: %s", [[dateField1 objectValue] description]);
|
||||
}
|
||||
|
||||
- (void)objectValue2:(id)sender
|
||||
- (@action)objectValue2:(id)sender
|
||||
{
|
||||
CPLog.info("Date 2: %s", [[dateField2 objectValue] description]);
|
||||
}
|
||||
|
||||
- (void)setNil:(id)sender
|
||||
- (@action)setNil:(id)sender
|
||||
{
|
||||
[dateField1 setStringValue:nil]; // should log a warning and do nothing
|
||||
}
|
||||
|
||||
- (void)setEmptyOK:(id)sender
|
||||
- (@action)setEmptyOK:(id)sender
|
||||
{
|
||||
[[dateField2 formatter] setEmptyIsValid:[sender state] === CPOnState];
|
||||
}
|
||||
|
||||
- (@action)deleteBackward1:(id)sender
|
||||
{
|
||||
[dateField1 deleteBackward:self];
|
||||
}
|
||||
|
||||
- (@action)deleteBackward2:(id)sender
|
||||
{
|
||||
[dateField2 deleteBackward:self];
|
||||
}
|
||||
|
||||
- (@action)deleteBackward3:(id)sender
|
||||
{
|
||||
[textField deleteBackward:self];
|
||||
}
|
||||
|
||||
- (@action)deleteForward1:(id)sender
|
||||
{
|
||||
[dateField1 deleteForward:self];
|
||||
}
|
||||
|
||||
- (@action)deleteForward2:(id)sender
|
||||
{
|
||||
[dateField2 deleteForward:self];
|
||||
}
|
||||
|
||||
- (@action)deleteForward3:(id)sender
|
||||
{
|
||||
[textField deleteForward:self];
|
||||
}
|
||||
|
||||
- (@action)delete1:(id)sender
|
||||
{
|
||||
[dateField1 delete:self];
|
||||
}
|
||||
|
||||
- (@action)delete2:(id)sender
|
||||
{
|
||||
[dateField2 delete:self];
|
||||
}
|
||||
|
||||
- (@action)delete3:(id)sender
|
||||
{
|
||||
[textField delete:self];
|
||||
}
|
||||
|
||||
- (void)controlTextDidChange:(CPNotification)aNotification
|
||||
{
|
||||
var field = [aNotification object],
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,7 @@
|
||||
[self updateAddTemplateButton];
|
||||
|
||||
[window setBackgroundColor:[CPColor colorWithHexString:@"f3f4f5"]];
|
||||
[window setFullBridge:YES];
|
||||
[window setFullPlatformWindow:YES];
|
||||
}
|
||||
|
||||
- (IBAction)predicateEditorAction:(id)sender
|
||||
@@ -123,6 +123,14 @@
|
||||
}
|
||||
else if (type == 3)
|
||||
template = [[CPPredicateEditorRowTemplate alloc] initWithLeftExpressions:leftExpressions rightExpressionAttributeType:CPDateAttributeType modifier:0 operators:operators options:0];
|
||||
else if (type == 4)
|
||||
template = [[CPPredicateEditorRowTemplate alloc] initWithLeftExpressions:leftExpressions rightExpressionAttributeType:CPBooleanAttributeType modifier:0 operators:operators options:0];
|
||||
else if (type == 5)
|
||||
{
|
||||
var expressions = [CPArray arrayWithObjects:[CPExpression expressionForConstantValue:@"Apple"], [CPExpression expressionForConstantValue:@"Microsoft"], [CPExpression expressionForConstantValue:@"Linux"]]
|
||||
template = [[CPPredicateEditorRowTemplate alloc] initWithLeftExpressions:leftExpressions rightExpressions:expressions modifier:0 operators:operators options:0];
|
||||
|
||||
}
|
||||
|
||||
var templates = [[predicateEditor rowTemplates] arrayByAddingObject:template];
|
||||
[predicateEditor setRowTemplates:templates];
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication"/>
|
||||
@@ -734,15 +734,17 @@
|
||||
<popUpButton verticalHuggingPriority="750" id="1274">
|
||||
<rect key="frame" x="6" y="145" width="223" height="26"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" title="Strings" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="1277" id="1275">
|
||||
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="1275">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" title="OtherViews" id="1276">
|
||||
<items>
|
||||
<menuItem title="Strings" state="on" id="1277"/>
|
||||
<menuItem title="Strings" id="1277"/>
|
||||
<menuItem title="Numbers" id="1278"/>
|
||||
<menuItem title="Constant Values" id="1279"/>
|
||||
<menuItem title="Dates" id="9Za-l5-lSK"/>
|
||||
<menuItem title="Booleans" id="Nuh-0m-Oqs"/>
|
||||
<menuItem title="Choice" id="Ia8-PU-zQd"/>
|
||||
</items>
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
@@ -928,4 +930,4 @@
|
||||
</declaredKeys>
|
||||
</objectController>
|
||||
</objects>
|
||||
</document>
|
||||
</document>
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* Copyright 2012, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
CPLogRegister(CPLogConsole)
|
||||
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
@implementation AppController : CPObject
|
||||
@@ -30,10 +32,10 @@
|
||||
|
||||
- (id)newObject
|
||||
{
|
||||
var randIndex = FLOOR(RAND()*3),
|
||||
randLabel = ["un", "deux", "trois", nil][FLOOR(RAND()*4)],
|
||||
randTag = FLOOR(RAND()*3);
|
||||
|
||||
var randIndex = FLOOR(RAND() * 3),
|
||||
randLabel = ["Label1", "Label2", "Label3", nil][FLOOR(RAND() * 4)],
|
||||
randTag = FLOOR(RAND() * 3);
|
||||
|
||||
return [CPDictionary dictionaryWithObjectsAndKeys:randIndex, @"index", randLabel, @"label", randTag, @"tag"];
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -50,8 +50,13 @@
|
||||
[shadowLabel setFrame:CGRectMake(15, CGRectGetMaxY([textField frame]) + 10, 300, 18)];
|
||||
[championOfLightLabel setFrame:CGRectMake(15, CGRectGetMaxY([shadowLabel frame]) + 2, 300, 18)];
|
||||
|
||||
var selectableLabel = [CPTextField labelWithTitle:@"This text should be selectable and you should see the selectable cursor."];
|
||||
[selectableLabel setSelectable:YES];
|
||||
[selectableLabel setFrame:CGRectMake(15, CGRectGetMaxY([championOfLightLabel frame]) + 8, 600, 18)];
|
||||
|
||||
[contentView addSubview:shadowLabel];
|
||||
[contentView addSubview:championOfLightLabel];
|
||||
[contentView addSubview:selectableLabel];
|
||||
|
||||
var jumpLabel = [CPTextField labelWithTitle:@"The text of these text fields should not move ('jump') when a field becomes the first responder. Labels on the right should replicate the input."];
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* CPTextFielMultine
|
||||
*
|
||||
* Created by You on November 12, 2014.
|
||||
* Copyright 2014, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
@outlet CPTextField field1;
|
||||
@outlet CPTextField field2;
|
||||
@outlet CPTextField field3;
|
||||
@outlet CPWindow theWindow;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
var s = [field1 frameSize];
|
||||
s.height = 83;
|
||||
[field1 setFrameSize:s]
|
||||
|
||||
var s = [field2 frameSize];
|
||||
s.height = 83;
|
||||
[field2 setFrameSize:s]
|
||||
|
||||
var s = [field3 frameSize];
|
||||
s.height = 83;
|
||||
[field3 setFrameSize:s]
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
[theWindow setFullPlatformWindow:YES];
|
||||
}
|
||||
|
||||
- (IBAction)actionSent:(id)aSender
|
||||
{
|
||||
CPLog.debug("action sent from " + aSender);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Main cib file base name</key>
|
||||
<string>MainMenu.cib</string>
|
||||
<key>CPBundleName</key>
|
||||
<string>CPTextFieldMultiline</string>
|
||||
<key>CPBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CPHumanReadableCopyright</key>
|
||||
<string>Copyright © 2014, Your Company All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* CPTextFielMultine
|
||||
*
|
||||
* Created by You on November 12, 2014.
|
||||
* Copyright 2014, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
var ENV = require("system").env,
|
||||
FILE = require("file"),
|
||||
JAKE = require("jake"),
|
||||
task = JAKE.task,
|
||||
FileList = JAKE.FileList,
|
||||
app = require("cappuccino/jake").app,
|
||||
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
|
||||
OS = require("os"),
|
||||
projectName = "CPTextFielMultine";
|
||||
|
||||
app (projectName, function(task)
|
||||
{
|
||||
ENV["OBJJ_INCLUDE_PATHS"] = "Frameworks";
|
||||
|
||||
if (configuration === "Debug")
|
||||
ENV["OBJJ_INCLUDE_PATHS"] = FILE.join(ENV["OBJJ_INCLUDE_PATHS"], configuration);
|
||||
|
||||
task.setBuildIntermediatesPath(FILE.join("Build", "CPTextFielMultine.build", configuration));
|
||||
task.setBuildPath(FILE.join("Build", configuration));
|
||||
|
||||
task.setProductName("CPTextFielMultine");
|
||||
task.setIdentifier("com.yourcompany.CPTextFielMultine");
|
||||
task.setVersion("1.0");
|
||||
task.setAuthor("Your Company");
|
||||
task.setEmail("feedback @nospam@ yourcompany.com");
|
||||
task.setSummary("CPTextFielMultine");
|
||||
task.setSources(new FileList("**/*.j").exclude(FILE.join("Build", "**")).exclude(FILE.join("Frameworks", "Source", "**")));
|
||||
task.setResources(new FileList("Resources/**"));
|
||||
task.setIndexFilePath("index.html");
|
||||
task.setInfoPlistPath("Info.plist");
|
||||
|
||||
if (configuration === "Debug")
|
||||
task.setCompilerFlags("-DDEBUG -g");
|
||||
else
|
||||
task.setCompilerFlags("-O");
|
||||
});
|
||||
|
||||
task ("default", [projectName], function()
|
||||
{
|
||||
printResults(configuration);
|
||||
});
|
||||
|
||||
task ("build", ["default"], function()
|
||||
{
|
||||
updateApplicationSize();
|
||||
});
|
||||
|
||||
task ("debug", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Debug";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("release", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Release";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("run", ["debug"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Debug", projectName, "index.html")]);
|
||||
});
|
||||
|
||||
task ("run-release", ["release"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Release", projectName, "index.html")]);
|
||||
});
|
||||
|
||||
task ("deploy", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Deployment", projectName));
|
||||
OS.system(["press", "-f", FILE.join("Build", "Release", projectName), FILE.join("Build", "Deployment", projectName)]);
|
||||
printResults("Deployment")
|
||||
});
|
||||
|
||||
task ("desktop", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Desktop", projectName));
|
||||
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", projectName), FILE.join("Build", "Desktop", projectName, "CPTextFielMultine.app"));
|
||||
printResults("Desktop")
|
||||
});
|
||||
|
||||
task ("run-desktop", ["desktop"], function()
|
||||
{
|
||||
OS.system([FILE.join("Build", "Desktop", projectName, "CPTextFielMultine.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||
});
|
||||
|
||||
function printResults(configuration)
|
||||
{
|
||||
print("----------------------------");
|
||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, projectName));
|
||||
print("----------------------------");
|
||||
}
|
||||
|
||||
function updateApplicationSize()
|
||||
{
|
||||
print("Calculating application file sizes...");
|
||||
|
||||
var contents = FILE.read(FILE.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), { charset:"UTF-8" }),
|
||||
format = CFPropertyList.sniffedFormatOfString(contents),
|
||||
plist = CFPropertyList.propertyListFromString(contents),
|
||||
totalBytes = {executable:0, data:0, mhtml:0};
|
||||
|
||||
// Get the size of all framework executables and sprite data
|
||||
var frameworksDir = "Frameworks";
|
||||
|
||||
if (ENV["CONFIGURATION"] === "Debug")
|
||||
frameworksDir = FILE.join(frameworksDir, "Debug");
|
||||
|
||||
var frameworks = FILE.list(frameworksDir);
|
||||
|
||||
frameworks.forEach(function(framework)
|
||||
{
|
||||
if (framework !== "Source")
|
||||
addBundleFileSizes(FILE.join(frameworksDir, framework), totalBytes);
|
||||
});
|
||||
|
||||
// Read in the default theme name, and attempt to get its size
|
||||
var themeName = plist.valueForKey("CPDefaultTheme") || "Aristo2",
|
||||
themePath = nil;
|
||||
|
||||
if (themeName === "Aristo" || themeName === "Aristo2")
|
||||
themePath = FILE.join(frameworksDir, "AppKit", "Resources", themeName + ".blend");
|
||||
else
|
||||
themePath = FILE.join("Frameworks", "Resources", themeName + ".blend");
|
||||
|
||||
if (FILE.isDirectory(themePath))
|
||||
addBundleFileSizes(themePath, totalBytes);
|
||||
|
||||
// Add sizes for the app
|
||||
addBundleFileSizes(FILE.join("Build", ENV["CONFIGURATION"], projectName), totalBytes);
|
||||
|
||||
print("Executables: " + totalBytes.executable + ", sprite data: " + totalBytes.data + ", total: " + (totalBytes.executable + totalBytes.data));
|
||||
|
||||
var dict = new CFMutableDictionary();
|
||||
|
||||
dict.setValueForKey("executable", totalBytes.executable);
|
||||
dict.setValueForKey("data", totalBytes.data);
|
||||
dict.setValueForKey("mhtml", totalBytes.mhtml);
|
||||
|
||||
plist.setValueForKey("CPApplicationSize", dict);
|
||||
|
||||
FILE.write(FILE.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
|
||||
}
|
||||
|
||||
function addBundleFileSizes(bundlePath, totalBytes)
|
||||
{
|
||||
var bundleName = FILE.basename(bundlePath),
|
||||
environment = bundleName === "Foundation" ? "Objj" : "Browser",
|
||||
bundlePath = FILE.join(bundlePath, environment + ".environment");
|
||||
|
||||
if (FILE.isDirectory(bundlePath))
|
||||
{
|
||||
var filename = bundleName + ".sj",
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, filename));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.executable += filePath.size();
|
||||
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, "dataURLs.txt"));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.data += filePath.size();
|
||||
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, "MHTMLData.txt"));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.mhtml += filePath.size();
|
||||
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, "MHTMLPaths.txt"));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.mhtml += filePath.size();
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,191 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!--
|
||||
index-debug.html
|
||||
CPTextFielMultine
|
||||
|
||||
Created by You on November 12, 2014.
|
||||
Copyright 2014, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!--[if lte IE 8]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1">
|
||||
<![endif]-->
|
||||
<!--[if gte IE 9]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
|
||||
<![endif]-->
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png">
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png">
|
||||
|
||||
<title>CPTextFielMultine</title>
|
||||
|
||||
<!-- Custom javascript goes here -->
|
||||
<!-- End custom javascript -->
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks"];
|
||||
|
||||
var progressBar = null;
|
||||
|
||||
OBJJ_PROGRESS_CALLBACK = function(percent, appSize, path)
|
||||
{
|
||||
percent = percent * 100;
|
||||
|
||||
if (!progressBar)
|
||||
progressBar = document.getElementById("progress-bar");
|
||||
|
||||
if (progressBar)
|
||||
progressBar.style.width = Math.min(percent, 100) + "%";
|
||||
}
|
||||
|
||||
var loadingHTML =
|
||||
'<div id="loading">' +
|
||||
' <div id="loading-text">Loading...</div>' +
|
||||
' <div id="progress-indicator">' +
|
||||
' <span id="progress-bar" style="width:0%"></span>' +
|
||||
' </div>' +
|
||||
'</div>';
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
|
||||
// DEBUG OPTIONS:
|
||||
|
||||
// Uncomment to enable printing of backtraces on exceptions:
|
||||
//objj_msgSend_decorate(objj_backtrace_decorator);
|
||||
|
||||
// Uncomment to supress exceptions that take place inside a message
|
||||
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
|
||||
|
||||
// Uncomment to enable runtime type checking:
|
||||
//objj_msgSend_decorate(objj_typecheck_decorator);
|
||||
|
||||
// Uncomment (along with both above) to print backtraces on type check errors:
|
||||
//objj_typecheck_prints_backtrace = true;
|
||||
|
||||
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
|
||||
//CPLogUnregister(CPLogDefault);
|
||||
|
||||
// Uncomment to enable a specific logger:
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
|
||||
// Tag view DOM elements with a "data-cappuccino-view" attribute that contains
|
||||
// the class name of the view that created them. Comment this or set to false to disable.
|
||||
appkit_tag_dom_elements = true;
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
html, body, h1, p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* We need a body wrapper because Cappuccino is unhappy if we change the body element */
|
||||
#cappuccino-body {
|
||||
/* Position it absolutely so it will fill the height without content */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
|
||||
/* Put it at the bottom of the stack so it doesn't interfere with UI */
|
||||
z-index: -1000;
|
||||
}
|
||||
|
||||
#cappuccino-body .container {
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#cappuccino-body .content {
|
||||
display: table-cell;
|
||||
height: 100%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#loading {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
}
|
||||
|
||||
#loading-text {
|
||||
height: 1.5em;
|
||||
color: #555;
|
||||
font: normal bold 36px/36px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#progress-indicator {
|
||||
padding: 0px;
|
||||
height: 16px;
|
||||
border: 5px solid #555;
|
||||
border-radius: 18px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#progress-bar {
|
||||
position: relative;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
display: block;
|
||||
height: 18px;
|
||||
|
||||
/* Compensate for moving the bar left 1px to overlap the indicator border */
|
||||
border-right: 1px solid #555;
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
#noscript {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
padding: 1em 1.5em;
|
||||
border: 5px solid #555;
|
||||
border-radius: 16px;
|
||||
background-color: white;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
font: bold 24px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#noscript a {
|
||||
color: #98c0ff;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="cappuccino-body">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<script type="text/javascript">
|
||||
document.write(loadingHTML);
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<noscript style="position:absolute; top:0; left:0; width:100%; height:100%">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<div id="noscript">
|
||||
<p style="font-size:120%; margin-bottom:.75em">JavaScript is required for this site.</p>
|
||||
<p><a href="http://www.enable-javascript.com" target="_blank">Enable JavaScript</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,161 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!--
|
||||
index.html
|
||||
CPTextFielMultine
|
||||
|
||||
Created by You on November 12, 2014.
|
||||
Copyright 2014, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!--[if lte IE 8]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1">
|
||||
<![endif]-->
|
||||
<!--[if gte IE 9]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
|
||||
<![endif]-->
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png">
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png">
|
||||
|
||||
<title>CPTextFielMultine</title>
|
||||
|
||||
<!-- Custom javascript goes here -->
|
||||
<!-- End custom javascript -->
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
|
||||
var progressBar = null;
|
||||
|
||||
OBJJ_PROGRESS_CALLBACK = function(percent, appSize, path)
|
||||
{
|
||||
percent = percent * 100;
|
||||
|
||||
if (!progressBar)
|
||||
progressBar = document.getElementById("progress-bar");
|
||||
|
||||
if (progressBar)
|
||||
progressBar.style.width = Math.min(percent, 100) + "%";
|
||||
}
|
||||
|
||||
var loadingHTML =
|
||||
'<div id="loading">' +
|
||||
' <div id="loading-text">Loading...</div>' +
|
||||
' <div id="progress-indicator">' +
|
||||
' <span id="progress-bar" style="width:0%"></span>' +
|
||||
' </div>' +
|
||||
'</div>';
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<style type="text/css">
|
||||
html, body, h1, p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* We need a body wrapper because Cappuccino is unhappy if we change the body element */
|
||||
#cappuccino-body {
|
||||
/* Position it absolutely so it will fill the height without content */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
|
||||
/* Put it at the bottom of the stack so it doesn't interfere with UI */
|
||||
z-index: -1000;
|
||||
}
|
||||
|
||||
#cappuccino-body .container {
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#cappuccino-body .content {
|
||||
display: table-cell;
|
||||
height: 100%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#loading {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
}
|
||||
|
||||
#loading-text {
|
||||
height: 1.5em;
|
||||
color: #555;
|
||||
font: normal bold 36px/36px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#progress-indicator {
|
||||
padding: 0px;
|
||||
height: 16px;
|
||||
border: 5px solid #555;
|
||||
border-radius: 18px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#progress-bar {
|
||||
position: relative;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
display: block;
|
||||
height: 18px;
|
||||
|
||||
/* Compensate for moving the bar left 1px to overlap the indicator border */
|
||||
border-right: 1px solid #555;
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
#noscript {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
padding: 1em 1.5em;
|
||||
border: 5px solid #555;
|
||||
border-radius: 16px;
|
||||
background-color: white;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
font: bold 24px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#noscript a {
|
||||
color: #98c0ff;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="cappuccino-body">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<script type="text/javascript">
|
||||
document.write(loadingHTML);
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<noscript style="position:absolute; top:0; left:0; width:100%; height:100%">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<div id="noscript">
|
||||
<p style="font-size:120%; margin-bottom:.75em">JavaScript is required for this site.</p>
|
||||
<p><a href="http://www.enable-javascript.com" target="_blank">Enable JavaScript</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* CPTextFielMultine
|
||||
*
|
||||
* Created by You on November 12, 2014.
|
||||
* Copyright 2014, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "AppController.j"
|
||||
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
@@ -6,5 +6,7 @@
|
||||
<string>MainMenu.cib</string>
|
||||
<key>CPBundleName</key>
|
||||
<string>nib2cibAlignment</string>
|
||||
<key>CPDefaultTheme</key>
|
||||
<string>Aristo2</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
|
||||
@implementation Class
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation Class (Accessors)
|
||||
{
|
||||
Type ivar @accessors;
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
var the_class=objj_allocateClassPair(Nil,"Class"),meta_class=the_class.isa;
|
||||
objj_registerClassPair(the_class);
|
||||
var the_class=objj_getClass("Class");
|
||||
if(!the_class){
|
||||
throw new SyntaxError("*** Could not find definition for class \"Class\"");
|
||||
}
|
||||
var meta_class=the_class.isa;
|
||||
class_addIvars(the_class,[new objj_ivar("ivar")]);
|
||||
class_addMethods(the_class,[new objj_method(sel_getUid("ivar"),function $Class__ivar(_1,_2){
|
||||
return _1.ivar;
|
||||
},["Type"]),new objj_method(sel_getUid("setIvar:"),function $Class__setIvar_(_3,_4,_5){
|
||||
_3.ivar=_5;
|
||||
},["void","Type"])]);
|
||||
@@ -6,6 +6,7 @@ var FILENAMES = [
|
||||
"Class/root-class",
|
||||
"Class/root-class-one-ivar",
|
||||
"Class/root-class-multiple-ivars",
|
||||
"Class/accessors",
|
||||
|
||||
"Messages/no-parameters",
|
||||
"Messages/one-parameter",
|
||||
|
||||
@@ -29,6 +29,15 @@ function cleanup() {
|
||||
|
||||
status = OS.system(["flatten", "-f", "ToolsTestApp", "FlattenTestApp"].map(OS.enquote).join(" ") + " > /dev/null");
|
||||
[self assert:0 equals:status message:"flatten failed"];
|
||||
|
||||
status = OS.system(["objj", "ToolsTestApp/AppController.j"]);
|
||||
[self assert:0 equals:status message:"objj failed"];
|
||||
|
||||
status = OS.system(["objj", "-m", "ToolsTestApp/AppController.j", "ToolsTestApp/AppController.j"]);
|
||||
[self assert:0 equals:status message:"objj failed with several files"];
|
||||
|
||||
status = OS.system(["objj", "-I", "ToolsTestApp/Frameworks", "ToolsTestApp/AppController.j"]);
|
||||
[self assert:0 equals:status message:"objj failed with options -I"];
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user