26 @global appkit_tag_dom_elements
28 @
typedef _CPViewFullScreenModeState
32 if (typeof(appkit_tag_dom_elements) !==
"undefined" && appkit_tag_dom_elements)
34 AppKitTagDOMElement =
function(owner, element)
36 element.setAttribute(
"data-cappuccino-view", [owner className]);
37 element.setAttribute(
"data-cappuccino-uid", [owner UID]);
42 AppKitTagDOMElement =
function(owner, element)
93 _CPViewWillAppearNotification =
@"CPViewWillAppearNotification";
94 _CPViewDidAppearNotification =
@"CPViewDidAppearNotification";
95 _CPViewWillDisappearNotification =
@"CPViewWillDisappearNotification";
96 _CPViewDidDisappearNotification =
@"CPViewDidDisappearNotification";
104 var DOMElementPrototype = nil,
106 BackgroundTrivialColor = 0,
107 BackgroundVerticalThreePartImage = 1,
108 BackgroundHorizontalThreePartImage = 2,
109 BackgroundNinePartImage = 3,
110 BackgroundTransparentColor = 4,
111 BackgroundCSSStyling = 5;
151 CGAffineTransform _boundsTransform;
152 CGAffineTransform _inverseBoundsTransform;
154 CPSet _registeredDraggedTypes;
155 CPArray _registeredDraggedTypesArray;
158 BOOL _isHiddenOrHasHiddenAncestor;
162 BOOL _postsFrameChangedNotifications;
163 BOOL _postsBoundsChangedNotifications;
164 BOOL _inhibitFrameAndBoundsChangedNotifications;
166 BOOL _isSuperviewAClipView;
169 DOMElement _DOMElement;
170 DOMElement _DOMContentsElement;
172 CPArray _DOMImageParts;
173 CPArray _DOMImageSizes;
175 unsigned _backgroundType;
178 CPArray _cssStylePreviousState;
179 DOMElement _cssStyleNode;
187 BOOL _autoresizesSubviews;
188 unsigned _autoresizingMask;
194 BOOL _isInFullScreenMode;
196 _CPViewFullScreenModeState _fullScreenModeState;
200 CGSize _hierarchyScaleSize;
204 BOOL _needToSetTransformMatrix;
209 JSObject _ephemeralSubviews;
211 JSObject _ephemeralSubviewsForNames;
212 CPSet _ephereralSubviews;
218 unsigned _viewClassFlags;
222 Function _toolTipFunctionIn;
223 Function _toolTipFunctionOut;
224 BOOL _toolTipInstalled;
228 BOOL _allowsVibrancy;
233 BOOL _inhibitUpdateTrackingAreas;
237 BOOL _inhibitDOMUpdates;
247 if (
self !== [
CPView class])
251 DOMElementPrototype = document.createElement(
"div");
253 var style = DOMElementPrototype.style;
255 style.overflow =
"hidden";
256 style.position =
"absolute";
257 style.visibility =
"visible";
264 + (Class)_binderClassForBinding:(
CPString)aBinding
266 if ([aBinding hasPrefix:CPHiddenBinding])
269 return [
super _binderClassForBinding:aBinding];
276 + (void)setHighDPIDrawingEnabled:(BOOL)isEnabled
285 + (BOOL)isHighDPIDrawingEnabled
290 + (CPSet)keyPathsForValuesAffectingFrame
292 return [CPSet setWithObjects:@"frameOrigin", @"frameSize"];
295 + (CPSet)keyPathsForValuesAffectingBounds
297 return [CPSet setWithObjects:@"boundsOrigin", @"boundsSize"];
317 - (void)_setupViewFlags
319 var theClass = [
self class],
320 classUID = [theClass UID];
326 if ([theClass instanceMethodForSelector:
@selector(drawRect:)] !== [
CPView instanceMethodForSelector:
@selector(drawRect:)]
327 || [theClass instanceMethodForSelector:
@selector(viewWillDraw)] !== [
CPView instanceMethodForSelector:
@selector(viewWillDraw)])
330 if ([theClass instanceMethodForSelector:
@selector(viewWillLayout)] !== [
CPView instanceMethodForSelector:
@selector(viewWillLayout)])
333 if ([theClass instanceMethodForSelector:
@selector(layoutSubviews)] !== [
CPView instanceMethodForSelector:
@selector(layoutSubviews)])
351 - (id)initWithFrame:(CGRect)aFrame
357 var
width = CGRectGetWidth(aFrame),
358 height = CGRectGetHeight(aFrame);
361 _registeredDraggedTypes = [CPSet set];
362 _registeredDraggedTypesArray = [];
368 _frame = CGRectMakeCopy(aFrame);
369 _bounds = CGRectMake(0.0, 0.0,
width, height);
372 _autoresizesSubviews = YES;
373 _clipsToBounds = YES;
377 _isHiddenOrHasHiddenAncestor = NO;
380 _hierarchyScaleSize = CGSizeMake(1.0 , 1.0);
381 _scaleSize = CGSizeMake(1.0, 1.0);
385 _themeState = CPThemeStateNormal;
388 _DOMElement = DOMElementPrototype.cloneNode(
false);
389 AppKitTagDOMElement(
self, _DOMElement);
391 CPDOMDisplayServerSetStyleLeftTop(_DOMElement, NULL, CGRectGetMinX(aFrame), CGRectGetMinY(aFrame));
392 CPDOMDisplayServerSetStyleSize(_DOMElement,
width, height);
397 _cssStylePreviousState = @[];
401 _animationsDictionary = @{};
403 [
self _setupViewFlags];
404 [
self _loadThemeAttributes];
406 _inhibitDOMUpdates = NO;
425 if (_toolTip === aToolTip)
428 if (aToolTip && ![aToolTip isKindOfClass:
CPString])
433 [
self _manageToolTipInstallation];
436 - (void)_manageToolTipInstallation
438 if ([
self window] && _toolTip)
439 [
self _installToolTipEventHandlers];
441 [
self _uninstallToolTipEventHandlers];
447 - (void)_installToolTipEventHandlers
449 if (_toolTipInstalled)
452 if (!_toolTipFunctionIn)
453 _toolTipFunctionIn =
function(e) { [_CPToolTip scheduleToolTipForView:self]; };
455 if (!_toolTipFunctionOut)
456 _toolTipFunctionOut =
function(e) { [_CPToolTip invalidateCurrentToolTipIfNeeded]; };
459 if (_DOMElement.addEventListener)
461 _DOMElement.addEventListener(
"mouseover", _toolTipFunctionIn, YES);
462 _DOMElement.addEventListener(
"keypress", _toolTipFunctionOut, YES);
463 _DOMElement.addEventListener(
"mouseout", _toolTipFunctionOut, YES);
465 else if (_DOMElement.attachEvent)
467 _DOMElement.attachEvent(
"onmouseover", _toolTipFunctionIn);
468 _DOMElement.attachEvent(
"onkeypress", _toolTipFunctionOut);
469 _DOMElement.attachEvent(
"onmouseout", _toolTipFunctionOut);
473 _toolTipInstalled = YES;
480 - (void)_uninstallToolTipEventHandlers
482 if (!_toolTipInstalled)
486 if (_DOMElement.removeEventListener)
488 _DOMElement.removeEventListener(
"mouseover", _toolTipFunctionIn, YES);
489 _DOMElement.removeEventListener(
"keypress", _toolTipFunctionOut, YES);
490 _DOMElement.removeEventListener(
"mouseout", _toolTipFunctionOut, YES);
492 else if (_DOMElement.detachEvent)
494 _DOMElement.detachEvent(
"onmouseover", _toolTipFunctionIn);
495 _DOMElement.detachEvent(
"onkeypress", _toolTipFunctionOut);
496 _DOMElement.detachEvent(
"onmouseout", _toolTipFunctionOut);
500 _toolTipFunctionIn = nil;
501 _toolTipFunctionOut = nil;
503 _toolTipInstalled = NO;
521 return [_subviews copy];
538 [
self _insertSubview:aSubview atIndex:CPNotFound];
547 - (void)addSubview:(
CPView)aSubview positioned:(CPWindowOrderingMode)anOrderingMode relativeTo:(
CPView)anotherView
549 var index = anotherView ? [_subviews indexOfObjectIdenticalTo:anotherView] :
CPNotFound;
553 index = (anOrderingMode ===
CPWindowAbove) ? [_subviews count] : 0;
559 [
self _insertSubview:aSubview atIndex:index];
563 - (void)_insertSubview:(
CPView)aSubview atIndex:(
int)anIndex
565 if (aSubview ===
self)
568 if (!aSubview._superview && _subviews.indexOf(aSubview) !==
CPNotFound)
576 var count = _subviews.length,
580 [[
self window] _dirtyKeyViewLoop];
583 if (aSubview._superview ===
self)
585 var index = [_subviews indexOfObjectIdenticalTo:aSubview];
588 if (index === anIndex || index === count - 1 && anIndex === count)
591 [_subviews removeObjectAtIndex:index];
594 CPDOMDisplayServerRemoveChild(_DOMElement, aSubview._DOMElement);
605 var superview = aSubview._superview;
607 lastWindow = [superview window];
610 [aSubview _removeFromSuperview];
612 [aSubview _postViewWillAppearNotification];
614 [aSubview _setSuperview:self];
617 if (anIndex ===
CPNotFound || anIndex >= count)
619 _subviews.push(aSubview);
623 CPDOMDisplayServerAppendChild(_DOMElement, aSubview._DOMElement);
628 _subviews.splice(anIndex, 0, aSubview);
632 CPDOMDisplayServerInsertBefore(_DOMElement, aSubview._DOMElement, _subviews[anIndex + 1]._DOMElement);
636 [aSubview setNextResponder:self];
637 [aSubview _scaleSizeUnitSquareToSize:[
self _hierarchyScaleSize]];
643 [aSubview _setWindow:_window];
645 if (!_window && lastWindow)
646 [aSubview _setWindow:nil];
653 [aSubview _notifyViewDidBecomeFirstResponder];
655 [aSubview _notifyViewDidResignFirstResponder];
658 [aSubview _notifyWindowDidBecomeKey];
660 [aSubview _notifyWindowDidResignKey];
663 [
self didAddSubview:aSubview];
678 - (void)removeFromSuperview
680 var superview = _superview;
683 [
self _removeFromSuperview];
687 [
self _setWindow:nil];
690 - (void)_removeFromSuperview
696 [[
self window] _dirtyKeyViewLoop];
698 [_superview willRemoveSubview:self];
699 [
self _postViewWillDisappearNotification];
701 [_superview._subviews removeObjectIdenticalTo:self];
704 CPDOMDisplayServerRemoveChild(_superview._DOMElement, _DOMElement);
709 [
self _setSuperview:nil];
711 [
self _notifyWindowDidResignKey];
712 [
self _notifyViewDidResignFirstResponder];
722 if (aSubview._superview !==
self || aSubview === aView)
725 var index = [_subviews indexOfObjectIdenticalTo:aSubview];
727 [
self _insertSubview:aView atIndex:index];
732 - (void)setSubviews:(CPArray)newSubviews
735 [
CPException raise:CPInvalidArgumentException
reason:"newSubviews cannot be nil in -[CPView setSubviews:]"];
738 if ([_subviews
isEqual:newSubviews])
742 if ([_subviews count] === 0)
745 count = [newSubviews count];
747 for (; index < count; ++index)
748 [
self addSubview:newSubviews[index]];
754 if ([newSubviews count] === 0)
756 var count = [_subviews count];
759 [_subviews[count] removeFromSuperview];
765 var removedSubviews = [
CPMutableSet setWithArray:_subviews];
767 [removedSubviews removeObjectsInArray:newSubviews];
768 [removedSubviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
771 var addedSubviews = [
CPMutableSet setWithArray:newSubviews];
773 [addedSubviews removeObjectsInArray:_subviews];
775 var addedSubview = nil,
776 addedSubviewEnumerator = [addedSubviews objectEnumerator];
778 while ((addedSubview = [addedSubviewEnumerator nextObject]) !== nil)
782 if ([_subviews
isEqual:newSubviews])
785 _subviews = [newSubviews copy];
789 count = [_subviews count];
791 for (; index < count; ++index)
793 var subview = _subviews[index];
795 CPDOMDisplayServerRemoveChild(_DOMElement, subview._DOMElement);
796 CPDOMDisplayServerAppendChild(_DOMElement, subview._DOMElement);
802 - (void)_setWindow:(
CPWindow)aWindow
804 [[
self window] _dirtyKeyViewLoop];
807 if ([_window firstResponder] ===
self && _window != aWindow)
808 [_window makeFirstResponder:nil];
811 [
self viewWillMoveToWindow:aWindow];
815 if (_registeredDraggedTypes)
817 [_window _noteUnregisteredDraggedTypes:_registeredDraggedTypes];
818 [aWindow _noteRegisteredDraggedTypes:_registeredDraggedTypes];
822 if (_window && (_trackingAreas.length > 0))
823 [_window _removeTrackingAreaView:self];
831 if (_trackingAreas.length > 0)
834 [_window _addTrackingAreaView:self];
835 owners = [
self _calcTrackingAreaOwners];
842 [
self _updateTrackingAreasForOwners:owners];
845 var count = [_subviews count];
848 [_subviews[count] _setWindow:aWindow];
850 if ([_window isKeyWindow])
851 [
self setThemeState:CPThemeStateKeyWindow];
853 [
self unsetThemeState:CPThemeStateKeyWindow];
855 [
self viewDidMoveToWindow];
857 [
self _manageToolTipInstallation];
859 [[
self window] _dirtyKeyViewLoop];
874 }
while(view = [view superview])
882 - (void)viewDidMoveToSuperview
891 - (void)viewDidMoveToWindow
899 - (void)viewWillMoveToSuperview:(
CPView)aView
901 _isSuperviewAClipView = [aView isKindOfClass:[
CPClipView class]];
903 [
self _removeObservers];
906 [
self _addObservers];
925 - (void)_removeObservers
930 var count = [_subviews count];
933 [_subviews[count] _removeObservers];
938 - (void)_addObservers
943 var count = [_subviews count];
946 [_subviews[count] _addObservers];
959 while (view && ![view isKindOfClass:[_CPMenuItemView
class]])
960 view = [view superview];
963 return view._menuItem;
975 - (void)setTag:(CPInteger)aTag
987 if ([
self tag] === aTag)
991 count = _subviews.length;
993 for (; index < count; ++index)
995 var view = [_subviews[index] viewWithTag:aTag];
1020 - (void)setFrame:(CGRect)aFrame
1022 if (CGRectEqualToRect(_frame, aFrame) && !_forceUpdates)
1025 _inhibitFrameAndBoundsChangedNotifications = YES;
1030 _inhibitFrameAndBoundsChangedNotifications = NO;
1032 if (_postsFrameChangedNotifications)
1033 [CachedNotificationCenter postNotificationName:CPViewFrameDidChangeNotification object:self];
1035 if (_isSuperviewAClipView)
1038 if (!_inhibitUpdateTrackingAreas)
1039 [
self _updateTrackingAreasWithRecursion:YES];
1048 return CGRectMakeCopy(_frame);
1051 - (CGPoint)frameOrigin
1053 return CGPointMakeCopy(_frame.origin);
1058 return CGSizeMakeCopy(_frame.size);
1068 - (void)setCenter:(CGPoint)aPoint
1070 [
self setFrameOrigin:CGPointMake(aPoint.x - _frame.size.width / 2.0, aPoint.y - _frame.size.height / 2.0)];
1079 return CGPointMake(_frame.size.width / 2.0 + _frame.origin.x, _frame.size.height / 2.0 + _frame.origin.y);
1089 - (void)setFrameOrigin:(CGPoint)aPoint
1091 var origin = _frame.origin;
1093 if (!aPoint || (CGPointEqualToPoint(origin, aPoint) && !_forceUpdates))
1096 origin.x = aPoint.x;
1097 origin.y = aPoint.y;
1099 if (_postsFrameChangedNotifications && !_inhibitFrameAndBoundsChangedNotifications)
1100 [CachedNotificationCenter postNotificationName:CPViewFrameDidChangeNotification object:self];
1102 if (_isSuperviewAClipView && !_inhibitFrameAndBoundsChangedNotifications)
1106 if (!_inhibitDOMUpdates)
1108 var transform = _superview ? _superview._boundsTransform : NULL;
1110 CPDOMDisplayServerSetStyleLeftTop(_DOMElement, transform, origin.x, origin.y);
1114 if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications)
1115 [
self _updateTrackingAreasWithRecursion:YES];
1124 - (void)setFrameSize:(CGSize)aSize
1126 var size = _frame.size;
1128 if (!aSize || (CGSizeEqualToSize(size, aSize) && !_forceUpdates))
1131 var oldSize = CGSizeMakeCopy(size);
1133 size.width = aSize.width;
1134 size.height = aSize.height;
1138 _bounds.size.width = aSize.width * 1 / _scaleSize.width;
1139 _bounds.size.height = aSize.height * 1 / _scaleSize.height;
1143 [_layer _owningViewBoundsChanged];
1145 if (_autoresizesSubviews)
1152 [
self _setDisplayServerSetStyleSize:size];
1154 if (_backgroundType !== BackgroundTrivialColor)
1156 if (_backgroundType === BackgroundTransparentColor)
1158 CPDOMDisplayServerSetStyleSize(_DOMImageParts[0], size.width, size.height);
1162 var images = [[_backgroundColor patternImage] imageSlices],
1166 if (_backgroundType === BackgroundVerticalThreePartImage)
1168 var top = _DOMImageSizes[0] ? _DOMImageSizes[0].height : 0,
1169 bottom = _DOMImageSizes[2] ? _DOMImageSizes[2].height : 0;
1174 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width +
"px", top +
"px");
1175 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], size.width, top);
1178 if (_DOMImageSizes[1])
1180 var height = frameSize.height - top - bottom;
1182 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width +
"px", height +
"px");
1183 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], size.width, size.height - top - bottom);
1188 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width +
"px", bottom +
"px");
1189 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], size.width, bottom);
1192 else if (_backgroundType === BackgroundHorizontalThreePartImage)
1194 var left = _DOMImageSizes[0] ? _DOMImageSizes[0].width : 0,
1195 right = _DOMImageSizes[2] ? _DOMImageSizes[2].width : 0;
1200 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], left +
"px", frameSize.height +
"px");
1201 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], left, size.height);
1204 if (_DOMImageSizes[1])
1206 var
width = (frameSize.width - left - right);
1208 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex],
width +
"px", frameSize.height +
"px");
1209 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], size.width - left - right, size.height);
1214 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], right +
"px", frameSize.height +
"px");
1215 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], right, size.height);
1218 else if (_backgroundType === BackgroundNinePartImage)
1220 var left = _DOMImageSizes[0] ? _DOMImageSizes[0].width : 0,
1221 right = _DOMImageSizes[2] ? _DOMImageSizes[2].width : 0,
1222 top = _DOMImageSizes[0] ? _DOMImageSizes[0].height : 0,
1223 bottom = _DOMImageSizes[6] ? _DOMImageSizes[6].height : 0,
1224 width = size.width - left - right,
1225 height = size.height - top - bottom;
1227 if (_DOMImageSizes[0])
1229 if (_DOMImageSizes[1])
1231 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex],
width, top);
1234 if (_DOMImageSizes[2])
1236 if (_DOMImageSizes[3])
1238 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], _DOMImageSizes[3].
width, height);
1241 if (_DOMImageSizes[4])
1243 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex],
width, height);
1246 if (_DOMImageSizes[5])
1248 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], _DOMImageSizes[5].
width, height);
1251 if (_DOMImageSizes[6])
1253 if (_DOMImageSizes[7])
1255 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex],
width, _DOMImageSizes[7].height);
1262 if (_postsFrameChangedNotifications && !_inhibitFrameAndBoundsChangedNotifications)
1263 [CachedNotificationCenter postNotificationName:CPViewFrameDidChangeNotification object:self];
1265 if (_isSuperviewAClipView && !_inhibitFrameAndBoundsChangedNotifications)
1268 if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications)
1269 [
self _updateTrackingAreasWithRecursion:!_autoresizesSubviews];
1277 - (void)_setDisplayServerSetStyleSize:(CGSize)aSize
1280 var scale = [
self scaleSize];
1282 if (!_inhibitDOMUpdates)
1283 CPDOMDisplayServerSetStyleSize(_DOMElement, aSize.width * 1 / scale.width, aSize.height * 1 / scale.height);
1285 if (_DOMContentsElement)
1287 CPDOMDisplayServerSetSize(_DOMContentsElement, aSize.width * _highDPIRatio * 1 / scale.width, aSize.height * _highDPIRatio * 1 / scale.height);
1288 CPDOMDisplayServerSetStyleSize(_DOMContentsElement, aSize.width * 1 / scale.width, aSize.height * 1 / scale.height);
1290 _needToSetTransformMatrix = YES;
1300 - (void)setBounds:(CGRect)bounds
1302 if (CGRectEqualToRect(_bounds,
bounds))
1305 _inhibitFrameAndBoundsChangedNotifications = YES;
1310 _inhibitFrameAndBoundsChangedNotifications = NO;
1312 if (_postsBoundsChangedNotifications)
1313 [CachedNotificationCenter postNotificationName:CPViewBoundsDidChangeNotification object:self];
1315 if (_isSuperviewAClipView)
1318 if (!_inhibitUpdateTrackingAreas)
1319 [
self _updateTrackingAreasWithRecursion:YES];
1328 return CGRectMakeCopy(_bounds);
1331 - (CGPoint)boundsOrigin
1333 return CGPointMakeCopy(_bounds.origin);
1336 - (CGSize)boundsSize
1338 return CGSizeMakeCopy(_bounds.size);
1347 - (void)setBoundsOrigin:(CGPoint)aPoint
1349 var origin = _bounds.origin;
1351 if (CGPointEqualToPoint(origin, aPoint))
1354 origin.x = aPoint.x;
1355 origin.y = aPoint.y;
1357 if (origin.x != 0 || origin.y != 0)
1360 _inverseBoundsTransform = CGAffineTransformInvert(_boundsTransform);
1364 _boundsTransform = nil;
1365 _inverseBoundsTransform = nil;
1369 var index = _subviews.length;
1373 var view = _subviews[index],
1374 origin = view._frame.origin;
1376 CPDOMDisplayServerSetStyleLeftTop(view._DOMElement, _boundsTransform, origin.x, origin.y);
1380 if (_postsBoundsChangedNotifications && !_inhibitFrameAndBoundsChangedNotifications)
1381 [CachedNotificationCenter postNotificationName:CPViewBoundsDidChangeNotification object:self];
1383 if (_isSuperviewAClipView && !_inhibitFrameAndBoundsChangedNotifications)
1386 if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications)
1387 [
self _updateTrackingAreasWithRecursion:YES];
1396 - (void)setBoundsSize:(CGSize)aSize
1398 var size = _bounds.size;
1400 if (CGSizeEqualToSize(size, aSize))
1403 var frameSize = _frame.size;
1405 if (!CGSizeEqualToSize(size, frameSize))
1407 var origin = _bounds.origin;
1409 origin.x /= size.width / frameSize.width;
1410 origin.y /= size.height / frameSize.height;
1413 size.width = aSize.width;
1414 size.height = aSize.height;
1416 if (!CGSizeEqualToSize(size, frameSize))
1418 var origin = _bounds.origin;
1420 origin.x *= size.width / frameSize.width;
1421 origin.y *= size.height / frameSize.height;
1424 if (_postsBoundsChangedNotifications && !_inhibitFrameAndBoundsChangedNotifications)
1425 [CachedNotificationCenter postNotificationName:CPViewBoundsDidChangeNotification object:self];
1427 if (_isSuperviewAClipView && !_inhibitFrameAndBoundsChangedNotifications)
1430 if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications)
1431 [
self _updateTrackingAreasWithRecursion:YES];
1439 - (void)resizeWithOldSuperviewSize:(CGSize)aSize
1446 var
frame = _superview._frame,
1447 newFrame = CGRectMakeCopy(_frame),
1448 dX =
frame.size.width - aSize.width,
1449 dY =
frame.size.height - aSize.height,
1454 (mask &
CPViewMaxXMargin ? aSize.width - _frame.size.width - _frame.origin.x : 0),
1457 (mask &
CPViewMaxYMargin ? aSize.height - _frame.size.height - _frame.origin.y : 0);
1460 newFrame.origin.x += dX * (baseX > 0 ? _frame.origin.x / baseX : evenFractionX);
1463 newFrame.size.width += dX * (baseX > 0 ? _frame.size.width / baseX : evenFractionX);
1466 newFrame.origin.y += dY * (baseY > 0 ? _frame.origin.y / baseY : evenFractionY);
1469 newFrame.size.height += dY * (baseY > 0 ? _frame.size.height / baseY : evenFractionY);
1478 - (void)resizeSubviewsWithOldSize:(CGSize)aSize
1480 var count = _subviews.length;
1483 [_subviews[count] resizeWithOldSuperviewSize:aSize];
1493 - (void)setAutoresizesSubviews:(BOOL)aFlag
1495 _autoresizesSubviews = !!aFlag;
1502 - (BOOL)autoresizesSubviews
1504 return _autoresizesSubviews;
1511 - (void)setAutoresizingMask:(
unsigned)aMask
1513 _autoresizingMask = aMask;
1519 - (unsigned)autoresizingMask
1521 return _autoresizingMask;
1529 - (BOOL)enterFullScreenMode
1541 _fullScreenModeState = _CPViewFullScreenModeStateMake(
self);
1545 [fullScreenWindow setLevel:CPScreenSaverWindowLevel];
1546 [fullScreenWindow setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
1548 var contentView = [fullScreenWindow contentView];
1551 [contentView addSubview:self];
1554 [
self setFrame:CGRectMakeCopy([contentView bounds])];
1556 [fullScreenWindow makeKeyAndOrderFront:self];
1558 [fullScreenWindow makeFirstResponder:self];
1560 _isInFullScreenMode = YES;
1568 - (void)exitFullScreenMode
1579 if (!_isInFullScreenMode)
1582 _isInFullScreenMode = NO;
1584 [
self setFrame:_fullScreenModeState.frame];
1586 [_fullScreenModeState.superview _insertSubview:self atIndex:_fullScreenModeState.index];
1594 - (BOOL)isInFullScreenMode
1596 return _isInFullScreenMode;
1603 - (void)setHidden:(BOOL)aFlag
1607 if (_isHidden === aFlag)
1613 _DOMElement.style.display = aFlag ?
"none" :
"block";
1618 var view = [_window firstResponder];
1620 if ([view isKindOfClass:[
CPView class]])
1630 while (view = [view superview]);
1633 [
self _postViewWillDisappearNotification];
1634 [
self _recursiveGainedHiddenAncestor];
1640 [
self _postViewWillAppearNotification];
1641 [
self _recursiveLostHiddenAncestor];
1647 - (void)_postViewWillAppearNotification
1652 - (void)_postViewDidAppearNotification
1657 - (void)_postViewWillDisappearNotification
1662 - (void)_postViewDidDisappearNotification
1667 - (void)_setSuperview:(
CPView)aSuperview
1669 var hasOldSuperview = (_superview !== nil),
1670 hasNewSuperview = (aSuperview !== nil),
1671 oldSuperviewIsHidden = hasOldSuperview && [_superview isHiddenOrHasHiddenAncestor],
1674 if (!newSuperviewIsHidden && oldSuperviewIsHidden)
1675 [
self _recursiveLostHiddenAncestor];
1677 if (newSuperviewIsHidden && !oldSuperviewIsHidden)
1678 [
self _recursiveGainedHiddenAncestor];
1680 _superview = aSuperview;
1682 if (hasOldSuperview)
1683 [
self _postViewDidDisappearNotification];
1685 if (hasNewSuperview)
1686 [
self _postViewDidAppearNotification];
1689 - (void)_recursiveLostHiddenAncestor
1691 if (_isHiddenOrHasHiddenAncestor)
1693 _isHiddenOrHasHiddenAncestor = NO;
1694 [
self viewDidUnhide];
1697 [_subviews enumerateObjectsUsingBlock:function(view, idx, stop)
1699 [view _recursiveLostHiddenAncestor];
1703 - (void)_recursiveGainedHiddenAncestor
1710 _isHiddenOrHasHiddenAncestor = YES;
1712 [_subviews enumerateObjectsUsingBlock:function(view, idx, stop)
1714 [view _recursiveGainedHiddenAncestor];
1726 - (void)setClipsToBounds:(BOOL)shouldClip
1728 if (_clipsToBounds === shouldClip)
1731 _clipsToBounds = shouldClip;
1734 _DOMElement.style.overflow = _clipsToBounds ?
"hidden" :
"visible";
1738 - (BOOL)clipsToBounds
1740 return _clipsToBounds;
1748 - (void)setAlphaValue:(
float)anAlphaValue
1750 if (_opacity === anAlphaValue)
1753 _opacity = anAlphaValue;
1759 if (anAlphaValue === 1.0)
1760 try { _DOMElement.style.removeAttribute(
"filter") }
catch (anException) { }
1762 _DOMElement.style.filter =
"alpha(opacity=" + anAlphaValue * 100 +
")";
1765 _DOMElement.style.opacity = anAlphaValue;
1783 - (BOOL)isHiddenOrHasHiddenAncestor
1785 return _isHiddenOrHasHiddenAncestor;
1793 return ![
self isHiddenOrHasHiddenAncestor] && [[
self window] isVisible];
1819 - (void)viewDidUnhide
1847 - (void)setHitTests:(BOOL)shouldHitTest
1849 _hitTests = !!shouldHitTest;
1859 if (_isHidden || !_hitTests)
1863 sizeScale = [
self _hierarchyScaleSize];
1870 if (!CGRectContainsPoint(
frame, aPoint))
1874 i = _subviews.length,
1875 adjustedPoint = CGPointMake(aPoint.x - CGRectGetMinX(
frame), aPoint.y - CGRectGetMinY(
frame));
1877 if (_inverseBoundsTransform)
1897 if (view = [_subviews[i] hitTest:adjustedPoint])
1906 - (BOOL)needsPanelToBecomeKey
1915 - (BOOL)mouseDownCanMoveWindow
1922 if ([
self mouseDownCanMoveWindow])
1923 [
super mouseDown:anEvent];
1932 else if ([[
self nextResponder] isKindOfClass:
CPView])
1933 [
super rightMouseDown:anEvent];
1940 return [
self menu] || [[
self class] defaultMenu];
1949 if (_backgroundColor === aColor)
1952 if (aColor === [
CPNull null])
1955 _backgroundColor = aColor;
1958 if (_backgroundType === BackgroundCSSStyling)
1959 [_backgroundColor restorePreviousCSSState:@ref(_cssStylePreviousState) forDOMElement:_DOMElement];
1961 var patternImage = [_backgroundColor patternImage],
1962 colorExists = _backgroundColor && ([_backgroundColor patternImage] || [_backgroundColor alphaComponent] > 0.0),
1963 colorHasAlpha = colorExists && [_backgroundColor alphaComponent] < 1.0,
1965 colorNeedsDOMElement = colorHasAlpha && !supportsRGBA,
1969 isCSSBasedColor = [_backgroundColor isCSSBased];
1971 if (isCSSBasedColor)
1973 _backgroundType = BackgroundCSSStyling;
1974 amount = -_DOMImageParts.length;
1976 else if ([patternImage isThreePartImage])
1978 _backgroundType = [patternImage isVertical] ? BackgroundVerticalThreePartImage : BackgroundHorizontalThreePartImage;
1981 else if ([patternImage isNinePartImage])
1983 _backgroundType = BackgroundNinePartImage;
1988 _backgroundType = colorNeedsDOMElement ? BackgroundTransparentColor : BackgroundTrivialColor;
1989 amount = (colorNeedsDOMElement ? 1 : 0) - _DOMImageParts.length;
1993 if (_backgroundType === BackgroundVerticalThreePartImage || _backgroundType === BackgroundHorizontalThreePartImage || _backgroundType === BackgroundNinePartImage)
1995 slices = [patternImage imageSlices];
1998 amount = MIN(amount, slices.length);
2000 for (var i = 0, count = slices.length; i < count; i++)
2002 var image = slices[i],
2003 size = [image size];
2005 if (!size || (size.width === 0 && size.height === 0))
2008 _DOMImageSizes[i] = size;
2016 amount -= _DOMImageParts.length;
2024 var DOMElement = DOMElementPrototype.cloneNode(
false);
2026 DOMElement.style.zIndex = -1000;
2028 _DOMImageParts.push(DOMElement);
2029 _DOMElement.appendChild(DOMElement);
2036 _DOMElement.removeChild(_DOMImageParts.pop());
2039 if (_backgroundType === BackgroundCSSStyling)
2041 _cssStyleNode = [_backgroundColor applyCSSColorForView:self
2042 onDOMElement:_DOMElement
2043 styleNode:_cssStyleNode
2044 previousState:@ref(_cssStylePreviousState)];
2046 else if (_backgroundType === BackgroundTrivialColor || _backgroundType === BackgroundTransparentColor)
2048 var colorCSS = colorExists ? [_backgroundColor cssString] :
"";
2050 if (colorNeedsDOMElement)
2052 _DOMElement.style.background =
"";
2053 _DOMImageParts[0].style.background = [_backgroundColor cssString];
2056 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[0], [patternImage size].
width +
"px", [patternImage size].height +
"px");
2059 _DOMImageParts[0].style.filter =
"alpha(opacity=" + [_backgroundColor alphaComponent] * 100 +
")";
2061 _DOMImageParts[0].style.opacity = [_backgroundColor alphaComponent];
2063 var size = [
self bounds].size;
2064 CPDOMDisplayServerSetStyleSize(_DOMImageParts[0], size.width, size.height);
2068 _DOMElement.style.background = colorCSS;
2071 CPDOMDisplayServerSetStyleBackgroundSize(_DOMElement, [patternImage size].
width +
"px", [patternImage size].height +
"px");
2076 var frameSize = _frame.size,
2079 for (var i = 0; i < slices.length; i++)
2081 var size = _DOMImageSizes[i];
2086 var image = slices[i];
2091 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], size.width, size.height);
2093 _DOMImageParts[partIndex].style.background =
"url(\"" + [image filename] +
"\")";
2098 try { _DOMImageParts[partIndex].style.removeAttribute(
"filter") }
catch (anException) { }
2100 _DOMImageParts[partIndex].style.opacity = 1.0;
2106 if (_backgroundType === BackgroundNinePartImage)
2108 var left = _DOMImageSizes[0] ? _DOMImageSizes[0].width : 0,
2109 right = _DOMImageSizes[2] ? _DOMImageSizes[2].width : 0,
2110 top = _DOMImageSizes[0] ? _DOMImageSizes[0].height : 0,
2111 bottom = _DOMImageSizes[6] ? _DOMImageSizes[6].height : 0,
2112 width = frameSize.width - left - right,
2113 height = frameSize.height - top - bottom;
2117 if (_DOMImageSizes[0])
2119 CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
2122 if (_DOMImageSizes[1])
2124 CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, left, 0.0);
2125 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex],
width, _DOMImageSizes[1].height);
2128 if (_DOMImageSizes[2])
2130 CPDOMDisplayServerSetStyleRightTop(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
2133 if (_DOMImageSizes[3])
2135 CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, 0.0, top);
2136 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], _DOMImageSizes[3].
width, height);
2139 if (_DOMImageSizes[4])
2141 CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, left, top);
2142 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex],
width, height);
2145 if (_DOMImageSizes[5])
2147 CPDOMDisplayServerSetStyleRightTop(_DOMImageParts[partIndex], NULL, 0.0, top);
2148 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], _DOMImageSizes[5].
width, height);
2151 if (_DOMImageSizes[6])
2153 CPDOMDisplayServerSetStyleLeftBottom(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
2156 if (_DOMImageSizes[7])
2158 CPDOMDisplayServerSetStyleLeftBottom(_DOMImageParts[partIndex], NULL, left, 0.0);
2159 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex],
width, _DOMImageSizes[7].height);
2162 if (_DOMImageSizes[8])
2164 CPDOMDisplayServerSetStyleRightBottom(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
2167 else if (_backgroundType === BackgroundVerticalThreePartImage)
2169 var top = _DOMImageSizes[0] ? _DOMImageSizes[0].height : 0,
2170 bottom = _DOMImageSizes[2] ? _DOMImageSizes[2].height : 0;
2177 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width +
"px", top +
"px");
2178 CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
2179 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], frameSize.width, top);
2182 if (_DOMImageSizes[1])
2184 var height = frameSize.height - top - bottom;
2187 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width +
"px", height +
"px");
2188 CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, 0.0, top);
2189 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], frameSize.width, height);
2194 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], frameSize.width +
"px", bottom +
"px");
2195 CPDOMDisplayServerSetStyleLeftBottom(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
2196 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], frameSize.width, bottom);
2199 else if (_backgroundType === BackgroundHorizontalThreePartImage)
2201 var left = _DOMImageSizes[0] ? _DOMImageSizes[0].width : 0,
2202 right = _DOMImageSizes[2] ? _DOMImageSizes[2].width : 0;
2209 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], left +
"px", frameSize.height +
"px");
2210 CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
2211 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], left, frameSize.height);
2214 if (_DOMImageSizes[1])
2216 var
width = (frameSize.width - left - right);
2218 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex],
width +
"px", frameSize.height +
"px");
2219 CPDOMDisplayServerSetStyleLeftTop(_DOMImageParts[partIndex], NULL, left, 0.0);
2220 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex],
width, frameSize.height);
2225 CPDOMDisplayServerSetStyleBackgroundSize(_DOMImageParts[partIndex], right +
"px", frameSize.height +
"px");
2226 CPDOMDisplayServerSetStyleRightTop(_DOMImageParts[partIndex], NULL, 0.0, 0.0);
2227 CPDOMDisplayServerSetStyleSize(_DOMImageParts[partIndex], right, frameSize.height);
2239 return _backgroundColor;
2249 - (CGPoint)convertPoint:(CGPoint)aPoint fromView:(
CPView)aView
2262 - (CGPoint)convertPointFromBase:(CGPoint)aPoint
2273 - (CGPoint)convertPoint:(CGPoint)aPoint toView:(
CPView)aView
2287 - (CGPoint)convertPointToBase:(CGPoint)aPoint
2298 - (CGSize)convertSize:(CGSize)aSize fromView:(
CPView)aView
2312 - (CGSize)convertSize:(CGSize)aSize toView:(
CPView)aView
2326 - (CGRect)convertRect:(CGRect)aRect fromView:(
CPView)aView
2331 return CGRectApplyAffineTransform(aRect, _CPViewGetTransform(aView,
self));
2339 - (CGRect)convertRectFromBase:(CGRect)aRect
2350 - (CGRect)convertRect:(CGRect)aRect toView:(
CPView)aView
2355 return CGRectApplyAffineTransform(aRect, _CPViewGetTransform(
self, aView));
2363 - (CGRect)convertRectToBase:(CGRect)aRect
2380 - (void)setPostsFrameChangedNotifications:(BOOL)shouldPostFrameChangedNotifications
2382 shouldPostFrameChangedNotifications = !!shouldPostFrameChangedNotifications;
2384 if (_postsFrameChangedNotifications === shouldPostFrameChangedNotifications)
2387 _postsFrameChangedNotifications = shouldPostFrameChangedNotifications;
2393 - (BOOL)postsFrameChangedNotifications
2395 return _postsFrameChangedNotifications;
2410 - (void)setPostsBoundsChangedNotifications:(BOOL)shouldPostBoundsChangedNotifications
2412 shouldPostBoundsChangedNotifications = !!shouldPostBoundsChangedNotifications;
2414 if (_postsBoundsChangedNotifications === shouldPostBoundsChangedNotifications)
2417 _postsBoundsChangedNotifications = shouldPostBoundsChangedNotifications;
2425 - (BOOL)postsBoundsChangedNotifications
2427 return _postsBoundsChangedNotifications;
2440 - (void)dragImage:(
CPImage)anImage at:(CGPoint)aLocation offset:(CGSize)mouseOffset event:(
CPEvent)anEvent pasteboard:(
CPPasteboard)aPasteboard source:(
id)aSourceObject slideBack:(BOOL)slideBack
2442 [_window dragImage:anImage at:[
self convertPoint:aLocation
toView:nil] offset:mouseOffset event:anEvent pasteboard:aPasteboard source:aSourceObject slideBack:slideBack];
2455 - (void)dragView:(
CPView)aView at:(CGPoint)aLocation offset:(CGSize)mouseOffset event:(
CPEvent)anEvent pasteboard:(
CPPasteboard)aPasteboard source:(
id)aSourceObject slideBack:(BOOL)slideBack
2457 [_window dragView:aView at:[
self convertPoint:aLocation
toView:nil] offset:mouseOffset event:anEvent pasteboard:aPasteboard source:aSourceObject slideBack:slideBack];
2464 - (void)registerForDraggedTypes:(CPArray)pasteboardTypes
2466 if (!pasteboardTypes || ![pasteboardTypes count])
2469 var theWindow = [
self window];
2471 [theWindow _noteUnregisteredDraggedTypes:_registeredDraggedTypes];
2472 [_registeredDraggedTypes addObjectsFromArray:pasteboardTypes];
2473 [theWindow _noteRegisteredDraggedTypes:_registeredDraggedTypes];
2475 _registeredDraggedTypesArray = nil;
2482 - (CPArray)registeredDraggedTypes
2484 if (!_registeredDraggedTypesArray)
2485 _registeredDraggedTypesArray = [_registeredDraggedTypes allObjects];
2487 return _registeredDraggedTypesArray;
2493 - (void)unregisterDraggedTypes
2495 [[
self window] _noteUnregisteredDraggedTypes:_registeredDraggedTypes];
2497 _registeredDraggedTypes = [CPSet set];
2498 _registeredDraggedTypesArray = [];
2505 - (void)drawRect:(CGRect)aRect
2518 - (void)scaleUnitSquareToSize:(CGSize)aSize
2525 bounds.size.width *= _scaleSize.width;
2526 bounds.size.height *= _scaleSize.height;
2528 [
self willChangeValueForKey:@"scaleSize"];
2529 _scaleSize = CGSizeMakeCopy([
self scaleSize]);
2530 _scaleSize.height *= aSize.height;
2531 _scaleSize.width *= aSize.width;
2532 [
self didChangeValueForKey:@"scaleSize"];
2535 _hierarchyScaleSize = CGSizeMakeCopy([
self _hierarchyScaleSize]);
2536 _hierarchyScaleSize.height *= aSize.height;
2537 _hierarchyScaleSize.width *= aSize.width;
2540 newBounds = CGRectApplyAffineTransform(CGRectMakeCopy(
bounds), scaleAffine);
2544 [_subviews makeObjectsPerformSelector:@selector(_scaleSizeUnitSquareToSize:) withObject:aSize];
2551 - (void)_scaleSizeUnitSquareToSize:(CGSize)aSize
2553 _hierarchyScaleSize = CGSizeMakeCopy([_superview _hierarchyScaleSize]);
2557 _hierarchyScaleSize.width *= _scaleSize.width;
2558 _hierarchyScaleSize.height *= _scaleSize.height;
2561 [_subviews makeObjectsPerformSelector:@selector(_scaleSizeUnitSquareToSize:) withObject:aSize];
2567 - (CGSize)_hierarchyScaleSize
2569 return _hierarchyScaleSize || CGSizeMake(1.0, 1.0);
2575 - (void)_applyCSSScalingTranformations
2580 var scale = [
self scaleSize],
2584 self._DOMElement.style[browserPropertyTransform] =
'scale(' + scale.
width + ', ' + scale.height + ')';
2585 self._DOMElement.style[browserPropertyTransformOrigin] =
'0 0';
2587 [
self _setDisplayServerSetStyleSize:[
self frameSize]];
2601 [
self _applyCSSScalingTranformations];
2610 - (void)setNeedsDisplayInRect:(CGRect)aRect
2615 if (CGRectIsEmpty(aRect))
2618 if (_dirtyRect && !CGRectIsEmpty(_dirtyRect))
2619 _dirtyRect = CGRectUnion(aRect, _dirtyRect);
2621 _dirtyRect = CGRectMakeCopy(aRect);
2623 _CPDisplayServerAddDisplayObject(
self);
2626 - (BOOL)needsDisplay
2628 return _dirtyRect && !CGRectIsEmpty(_dirtyRect);
2634 - (void)displayIfNeeded
2636 if ([
self needsDisplay])
2648 - (void)displayIfNeededInRect:(CGRect)aRect
2650 if ([
self needsDisplay])
2658 - (void)displayRect:(CGRect)aRect
2682 - (void)viewWillDraw
2691 if (!_graphicsContext)
2696 var
width = CGRectGetWidth(_frame),
2697 height = CGRectGetHeight(_frame),
2698 devicePixelRatio = window.devicePixelRatio || 1,
2703 _DOMContentsElement = graphicsPort.DOMElement;
2705 _DOMContentsElement.style.zIndex = -100;
2707 _DOMContentsElement.style.overflow =
"hidden";
2708 _DOMContentsElement.style.position =
"absolute";
2709 _DOMContentsElement.style.visibility =
"visible";
2711 CPDOMDisplayServerSetSize(_DOMContentsElement,
width * _highDPIRatio, height * _highDPIRatio);
2713 CPDOMDisplayServerSetStyleLeftTop(_DOMContentsElement, NULL, 0.0, 0.0);
2714 CPDOMDisplayServerSetStyleSize(_DOMContentsElement,
width, height);
2719 _DOMElement.style.webkitTransform =
'translateX(0)';
2721 CPDOMDisplayServerAppendChild(_DOMElement, _DOMContentsElement);
2724 _needToSetTransformMatrix = YES;
2728 if (_needToSetTransformMatrix && _highDPIRatio !== 1)
2729 [_graphicsContext graphicsPort].setTransform(_highDPIRatio, 0, 0 , _highDPIRatio, 0, 0);
2732 _needToSetTransformMatrix = NO;
2748 - (void)setNeedsLayout
2753 - (void)setNeedsLayout:(BOOL)needLayout
2763 _CPDisplayServerAddLayoutObject(
self);
2768 return _needsLayout;
2784 - (void)layoutIfNeeded
2793 - (void)viewWillLayout
2801 - (void)viewDidLayout
2803 [
self _recomputeAppearance];
2806 - (void)layoutSubviews
2822 - (CGRect)visibleRect
2827 return CGRectIntersection([
self convertRect:[_superview visibleRect] fromView:_superview], _bounds);
2834 var superview = _superview,
2837 while (superview && ![superview isKindOfClass:clipViewClass])
2838 superview = superview._superview;
2847 - (void)scrollPoint:(CGPoint)aPoint
2849 var clipView = [
self _enclosingClipView];
2862 - (BOOL)scrollRectToVisible:(CGRect)aRect
2865 aRect = CGRectIntersection(aRect, _bounds);
2868 if (CGRectIsEmpty(aRect))
2871 var enclosingClipView = [
self _enclosingClipView];
2874 if (!enclosingClipView)
2877 var documentView = [enclosingClipView documentView];
2884 var documentViewVisibleRect = [documentView visibleRect],
2888 if (CGRectContainsRect(documentViewVisibleRect, rectInDocumentView))
2891 var currentScrollPoint = documentViewVisibleRect.origin,
2892 scrollPoint = CGPointMakeCopy(currentScrollPoint),
2893 rectInDocumentViewMinX = CGRectGetMinX(rectInDocumentView),
2894 documentViewVisibleRectMinX = CGRectGetMinX(documentViewVisibleRect),
2895 doesItFitForWidth = documentViewVisibleRect.size.width >= rectInDocumentView.size.width;
2898 if (rectInDocumentViewMinX < documentViewVisibleRectMinX && doesItFitForWidth)
2900 scrollPoint.x = rectInDocumentViewMinX;
2901 else if (CGRectGetMaxX(rectInDocumentView) > CGRectGetMaxX(documentViewVisibleRect) && doesItFitForWidth)
2903 scrollPoint.x = CGRectGetMaxX(rectInDocumentView) - documentViewVisibleRect.size.width;
2904 else if (rectInDocumentViewMinX > documentViewVisibleRectMinX)
2906 scrollPoint.x = rectInDocumentViewMinX;
2907 else if (CGRectGetMaxX(rectInDocumentView) < CGRectGetMaxX(documentViewVisibleRect))
2909 scrollPoint.x = CGRectGetMaxX(rectInDocumentView) - documentViewVisibleRect.size.width;
2911 var rectInDocumentViewMinY = CGRectGetMinY(rectInDocumentView),
2912 documentViewVisibleRectMinY = CGRectGetMinY(documentViewVisibleRect),
2913 doesItFitForHeight = documentViewVisibleRect.size.height >= rectInDocumentView.size.height;
2915 if (rectInDocumentViewMinY < documentViewVisibleRectMinY && doesItFitForHeight)
2917 scrollPoint.y = rectInDocumentViewMinY;
2918 else if (CGRectGetMaxY(rectInDocumentView) > CGRectGetMaxY(documentViewVisibleRect) && doesItFitForHeight)
2920 scrollPoint.y = CGRectGetMaxY(rectInDocumentView) - documentViewVisibleRect.size.height;
2921 else if (rectInDocumentViewMinY > documentViewVisibleRectMinY)
2923 scrollPoint.y = rectInDocumentViewMinY;
2924 else if (CGRectGetMaxY(rectInDocumentView) < CGRectGetMaxY(documentViewVisibleRect))
2926 scrollPoint.y = CGRectGetMaxY(rectInDocumentView) - documentViewVisibleRect.size.height;
2930 if (CGPointEqualToPoint(scrollPoint, currentScrollPoint))
2933 [enclosingClipView scrollToPoint:scrollPoint];
2952 - (CGRect)adjustScroll:(CGRect)proposedVisibleRect
2954 return proposedVisibleRect;
2960 - (void)scrollRect:(CGRect)aRect by:(
float)anAmount
2971 var superview = _superview,
2974 while (superview && ![superview isKindOfClass:scrollViewClass])
2975 superview = superview._superview;
2985 - (void)scrollClipView:(
CPClipView)aClipView toPoint:(CGPoint)aPoint
3002 - (BOOL)inLiveResize
3016 - (void)viewWillStartLiveResize
3018 _inLiveResize = YES;
3031 - (void)viewDidEndLiveResize
3056 var count = [_subviews count];
3060 if ([_subviews[count] performKeyEquivalent:anEvent])
3066 - (BOOL)canBecomeKeyView
3073 return _nextKeyView;
3079 resultUID = [result UID],
3080 unsuitableResults = {};
3082 while (result && ![result canBecomeKeyView])
3084 unsuitableResults[resultUID] = 1;
3085 result = [result nextKeyView];
3087 resultUID = [result UID];
3090 if (unsuitableResults[resultUID])
3099 return _previousKeyView;
3105 firstResult = result;
3107 while (result && ![result canBecomeKeyView])
3109 result = [result previousKeyView];
3112 if (result === firstResult)
3119 - (void)_setPreviousKeyView:(
CPView)previous
3123 var previousWindow = [previous
window];
3125 if (!previousWindow || previousWindow === _window)
3127 _previousKeyView = previous;
3132 _previousKeyView = nil;
3139 var nextWindow = [next
window];
3141 if (!nextWindow || nextWindow === _window)
3143 _nextKeyView = next;
3144 [_nextKeyView _setPreviousKeyView:self];
3161 if (_layer === aLayer)
3166 _layer._owningView = nil;
3168 _DOMElement.removeChild(_layer._DOMElement);
3178 [_layer _setOwningView:self];
3181 _layer._DOMElement.style.zIndex = 100;
3183 _DOMElement.appendChild(_layer._DOMElement);
3200 - (void)setWantsLayer:(BOOL)aFlag
3202 _wantsLayer = !!aFlag;
3224 - (void)setScaleSize:(CGSize)aSize
3226 if (CGSizeEqualToSize(_scaleSize, aSize))
3229 var size = CGSizeMakeZero(),
3230 scale = CGSizeMakeCopy([
self scaleSize]);
3232 size.height = aSize.height / scale.height;
3233 size.width = aSize.width / scale.width;
3245 return _scaleSize || CGSizeMake(1.0, 1.0);
3253 #pragma mark Override 3257 var shouldLayout = [
super setThemeState:aState];
3270 var shouldLayout = [
super unsetThemeState:aState];
3283 [
super setThemeClass:theClass];
3290 #pragma mark First responder 3292 - (BOOL)becomeFirstResponder
3294 var r = [
super becomeFirstResponder];
3297 [
self _notifyViewDidBecomeFirstResponder];
3302 - (void)_notifyViewDidBecomeFirstResponder
3304 [
self setThemeState:CPThemeStateFirstResponder];
3306 var count = [_subviews count];
3309 [_subviews[count] _notifyViewDidBecomeFirstResponder];
3312 - (BOOL)resignFirstResponder
3314 var r = [
super resignFirstResponder];
3317 [
self _notifyViewDidResignFirstResponder];
3322 - (void)_notifyViewDidResignFirstResponder
3324 [
self unsetThemeState:CPThemeStateFirstResponder];
3326 var count = [_subviews count];
3329 [_subviews[count] _notifyViewDidResignFirstResponder];
3332 - (void)_notifyWindowDidBecomeKey
3334 [
self setThemeState:CPThemeStateKeyWindow];
3336 var count = [_subviews count];
3339 [_subviews[count] _notifyWindowDidBecomeKey];
3342 - (void)_notifyWindowDidResignKey
3344 [
self unsetThemeState:CPThemeStateKeyWindow];
3346 var count = [_subviews count];
3349 [_subviews[count] _notifyWindowDidResignKey];
3352 #pragma mark Theme Attributes 3354 - (void)_setThemeIncludingDescendants:(
CPTheme)aTheme
3356 [
self setTheme:aTheme];
3357 [[
self subviews] makeObjectsPerformSelector:@selector(_setThemeIncludingDescendants:) withObject:aTheme];
3360 - (void)objectDidChangeTheme
3362 if (!_themeAttributes)
3365 [
super objectDidChangeTheme];
3373 var currentValue = [
self currentValueForThemeAttribute:aName];
3375 [
super setValue:aValue forThemeAttribute:aName inState:aState];
3377 if ([
self currentValueForThemeAttribute:aName] === currentValue)
3384 - (void)setValue:(
id)aValue forThemeAttribute:(
CPString)aName
3386 var currentValue = [
self currentValueForThemeAttribute:aName];
3388 [
super setValue:aValue forThemeAttribute:aName ];
3390 if ([
self currentValueForThemeAttribute:aName] === currentValue)
3402 - (CGRect)rectForEphemeralSubviewNamed:(
CPString)aViewName
3404 return CGRectMakeZero();
3408 positioned:(CPWindowOrderingMode)anOrderingMode
3409 relativeToEphemeralSubviewNamed:(
CPString)relativeToViewName
3411 if (!_ephemeralSubviewsForNames)
3413 _ephemeralSubviewsForNames = {};
3414 _ephemeralSubviews = [CPSet set];
3421 if (!_ephemeralSubviewsForNames[aViewName])
3425 [_ephemeralSubviews addObject:_ephemeralSubviewsForNames[aViewName]];
3427 if (_ephemeralSubviewsForNames[aViewName])
3431 if (_ephemeralSubviewsForNames[aViewName])
3432 [_ephemeralSubviewsForNames[aViewName] setFrame:frame];
3434 else if (_ephemeralSubviewsForNames[aViewName])
3436 [_ephemeralSubviewsForNames[aViewName] removeFromSuperview];
3438 [_ephemeralSubviews removeObject:_ephemeralSubviewsForNames[aViewName]];
3439 delete _ephemeralSubviewsForNames[aViewName];
3442 return _ephemeralSubviewsForNames[aViewName];
3447 if (!_ephemeralSubviewsForNames)
3450 return (_ephemeralSubviewsForNames[aViewName] || nil);
3476 return [_superview effectiveAppearance];
3481 if ([_appearance
isEqual:anAppearance])
3484 [
self willChangeValueForKey:@"appearance"];
3485 _appearance = anAppearance;
3486 [
self didChangeValueForKey:@"appearance"];
3493 - (void)_recomputeAppearance
3495 var effectiveAppearance = [
self effectiveAppearance];
3499 [
self setThemeState:CPThemeStateAppearanceAqua];
3500 [
self unsetThemeState:CPThemeStateAppearanceLightContent];
3501 [
self unsetThemeState:CPThemeStateAppearanceVibrantLight];
3502 [
self unsetThemeState:CPThemeStateAppearanceVibrantDark];
3506 [
self unsetThemeState:CPThemeStateAppearanceAqua];
3507 [
self setThemeState:CPThemeStateAppearanceLightContent];
3508 [
self unsetThemeState:CPThemeStateAppearanceVibrantLight];
3509 [
self unsetThemeState:CPThemeStateAppearanceVibrantDark];
3513 [
self unsetThemeState:CPThemeStateAppearanceAqua];
3514 [
self unsetThemeState:CPThemeStateAppearanceLightContent];
3515 [
self setThemeState:CPThemeStateAppearanceVibrantLight];
3516 [
self unsetThemeState:CPThemeStateAppearanceVibrantDark];
3520 [
self unsetThemeState:CPThemeStateAppearanceAqua];
3521 [
self unsetThemeState:CPThemeStateAppearanceLightContent];
3522 [
self unsetThemeState:CPThemeStateAppearanceVibrantLight];
3523 [
self setThemeState:CPThemeStateAppearanceVibrantDark];
3527 [
self unsetThemeState:CPThemeStateAppearanceAqua];
3528 [
self unsetThemeState:CPThemeStateAppearanceLightContent];
3529 [
self unsetThemeState:CPThemeStateAppearanceVibrantLight];
3530 [
self unsetThemeState:CPThemeStateAppearanceVibrantDark];
3535 for (var i = 0, size = [_subviews count]; i < size; i++)
3537 [[_subviews objectAtIndex:i] _recomputeAppearance];
3555 if (!trackingArea || [_trackingAreas containsObjectIdenticalTo:trackingArea])
3558 if ([trackingArea view])
3561 [_trackingAreas addObject:trackingArea];
3562 [trackingArea setView:self];
3565 [_window _addTrackingArea:trackingArea];
3567 [trackingArea _updateWindowRect];
3576 if (![_trackingAreas containsObjectIdenticalTo:trackingArea])
3579 [
self _removeTrackingArea:trackingArea];
3599 - (void)updateTrackingAreas
3609 [_window _removeTrackingArea:trackingArea];
3612 [_trackingAreas removeObjectIdenticalTo:trackingArea];
3615 - (void)_updateTrackingAreasWithRecursion:(BOOL)shouldCallRecursively
3617 _inhibitUpdateTrackingAreas = YES;
3619 [
self _updateTrackingAreasForOwners:[
self _calcTrackingAreaOwners]];
3621 if (shouldCallRecursively)
3625 for (var i = 0; i < _subviews.length; i++)
3626 [_subviews[i] _updateTrackingAreasWithRecursion:YES];
3629 _inhibitUpdateTrackingAreas = NO;
3632 - (CPArray)_calcTrackingAreaOwners
3640 for (var i = 0; i < _trackingAreas.length; i++)
3642 var trackingArea = _trackingAreas[i];
3645 [trackingArea _updateWindowRect];
3649 var owner = [trackingArea owner];
3651 if (![owners containsObjectIdenticalTo:owner])
3652 [owners addObject:owner];
3659 - (void)_updateTrackingAreasForOwners:(CPArray)owners
3661 for (var i = 0; i < owners.length; i++)
3662 [owners[i] updateTrackingAreas];
3703 _DOMElement = DOMElementPrototype.cloneNode(
false);
3704 AppKitTagDOMElement(
self, _DOMElement);
3708 _frame = [aCoder decodeRectForKey:CPViewFrameKey];
3709 _bounds = [aCoder decodeRectForKey:CPViewBoundsKey];
3711 self = [
super initWithCoder:aCoder];
3715 _trackingAreas = [aCoder decodeObjectForKey:CPViewTrackingAreasKey];
3717 if (!_trackingAreas)
3718 _trackingAreas = [];
3721 _tag = [aCoder containsValueForKey:CPViewTagKey] ? [aCoder decodeIntForKey:CPViewTagKey] : -1;
3722 _identifier = [aCoder decodeObjectForKey:CPReuseIdentifierKey];
3724 _window = [aCoder decodeObjectForKey:CPViewWindowKey];
3725 _superview = [aCoder decodeObjectForKey:CPViewSuperviewKey];
3730 var subviews = [aCoder decodeObjectForKey:CPViewSubviewsKey] || [];
3732 for (var i = 0, count = [subviews count]; i < count; ++i)
3735 subviews[i]._superview = nil;
3740 _registeredDraggedTypes = [CPSet set];
3741 _registeredDraggedTypesArray = [];
3745 if (_autoresizingMask === nil)
3746 _autoresizingMask = [aCoder decodeIntForKey:CPViewAutoresizingMaskKey] ||
CPViewNotSizable;
3748 _autoresizesSubviews = ![aCoder containsValueForKey:CPViewAutoresizesSubviewsKey] || [aCoder decodeBoolForKey:CPViewAutoresizesSubviewsKey];
3750 _hitTests = ![aCoder containsValueForKey:CPViewHitTestsKey] || [aCoder decodeBoolForKey:CPViewHitTestsKey];
3752 _toolTip = [aCoder decodeObjectForKey:CPViewToolTipKey];
3755 [
self _installToolTipEventHandlers];
3757 _scaleSize = [aCoder containsValueForKey:CPViewScaleKey] ? [aCoder decodeSizeForKey:CPViewScaleKey] : CGSizeMake(1.0, 1.0);
3758 _hierarchyScaleSize = [aCoder containsValueForKey:CPViewSizeScaleKey] ? [aCoder decodeSizeForKey:CPViewSizeScaleKey] : CGSizeMake(1.0, 1.0);
3759 _isScaled = [aCoder containsValueForKey:CPViewIsScaledKey] ? [aCoder decodeBoolForKey:CPViewIsScaledKey] : NO;
3763 _cssStylePreviousState = @[];
3765 _DOMImageParts = [];
3766 _DOMImageSizes = [];
3768 CPDOMDisplayServerSetStyleLeftTop(_DOMElement, NULL, CGRectGetMinX(_frame), CGRectGetMinY(_frame));
3769 [
self _setDisplayServerSetStyleSize:_frame.size];
3772 count = _subviews.length;
3774 for (; index < count; ++index)
3776 CPDOMDisplayServerAppendChild(_DOMElement, _subviews[index]._DOMElement);
3781 [
self setHidden:[aCoder decodeBoolForKey:CPViewIsHiddenKey]];
3782 _isHiddenOrHasHiddenAncestor = NO;
3785 [
self setAlphaValue:[aCoder decodeIntForKey:CPViewOpacityKey]];
3790 [
self _setupViewFlags];
3791 [
self _decodeThemeObjectsWithCoder:aCoder];
3793 [
self setAppearance:[aCoder decodeObjectForKey:CPViewAppearanceKey]];
3808 [
super encodeWithCoder:aCoder];
3811 [aCoder encodeInt:_tag forKey:CPViewTagKey];
3813 [aCoder encodeRect:_frame forKey:CPViewFrameKey];
3814 [aCoder encodeRect:_bounds forKey:CPViewBoundsKey];
3817 if (_window !== nil)
3818 [aCoder encodeConditionalObject:_window forKey:CPViewWindowKey];
3820 var count = [_subviews count],
3821 encodedSubviews = _subviews;
3823 if (count > 0 && [_ephemeralSubviews count] > 0)
3825 encodedSubviews = [encodedSubviews copy];
3828 if ([_ephemeralSubviews containsObject:encodedSubviews[count]])
3829 encodedSubviews.splice(count, 1);
3832 if (encodedSubviews.length > 0)
3833 [aCoder encodeObject:encodedSubviews forKey:CPViewSubviewsKey];
3836 if (_superview !== nil)
3837 [aCoder encodeConditionalObject:_superview forKey:CPViewSuperviewKey];
3840 [aCoder encodeInt:_autoresizingMask forKey:CPViewAutoresizingMaskKey];
3842 if (!_autoresizesSubviews)
3843 [aCoder encodeBool:_autoresizesSubviews forKey:CPViewAutoresizesSubviewsKey];
3845 if (_backgroundColor !== nil)
3846 [aCoder encodeObject:_backgroundColor forKey:CPViewBackgroundColorKey];
3848 if (_hitTests !== YES)
3849 [aCoder encodeBool:_hitTests forKey:CPViewHitTestsKey];
3851 if (_opacity !== 1.0)
3852 [aCoder encodeFloat:_opacity forKey:CPViewOpacityKey];
3855 [aCoder encodeBool:_isHidden forKey:CPViewIsHiddenKey];
3858 [aCoder encodeObject:_toolTip forKey:CPViewToolTipKey];
3862 if (nextKeyView !== nil && ![nextKeyView
isEqual:
self])
3863 [aCoder encodeConditionalObject:nextKeyView forKey:CPViewNextKeyViewKey];
3867 if (previousKeyView !== nil && ![previousKeyView
isEqual:
self])
3868 [aCoder encodeConditionalObject:previousKeyView forKey:CPViewPreviousKeyViewKey];
3870 [
self _encodeThemeObjectsWithCoder:aCoder];
3873 [aCoder encodeObject:_identifier forKey:CPReuseIdentifierKey];
3875 [aCoder encodeSize:[
self scaleSize] forKey:CPViewScaleKey];
3876 [aCoder encodeSize:[
self _hierarchyScaleSize] forKey:CPViewSizeScaleKey];
3877 [aCoder encodeBool:_isScaled forKey:CPViewIsScaledKey];
3878 [aCoder encodeObject:_appearance forKey:CPViewAppearanceKey];
3879 [aCoder encodeObject:_trackingAreas forKey:CPViewTrackingAreasKey];
3884 var _CPViewFullScreenModeStateMake =
function(aView)
3886 var superview = aView._superview;
3888 return { autoresizingMask:aView._autoresizingMask,
frame:CGRectMakeCopy(aView._frame), index:(superview ? [superview._subviews indexOfObjectIdenticalTo:aView] : 0), superview:superview };
3891 var _CPViewGetTransform =
function( fromView, toView)
3900 var view = fromView;
3905 while (view && view != toView)
3907 var
frame = view._frame;
3915 transform.tx += CGRectGetMinX(
frame);
3916 transform.ty += CGRectGetMinY(
frame);
3918 if (view._boundsTransform)
3931 view = view._superview;
3935 if (view === toView)
3939 else if (fromView && toView)
3941 fromWindow = [fromView window];
3942 toWindow = [toView window];
3944 if (fromWindow && toWindow && fromWindow !== toWindow)
3953 while (view && view != fromView)
3955 var
frame = CGRectMakeCopy(view._frame);
3960 transform2.a *= 1 / view._scaleSize.width;
3961 transform2.d *= 1 / view._scaleSize.height;
3964 transform2.tx += CGRectGetMinX(
frame) * transform2.a;
3965 transform2.ty += CGRectGetMinY(
frame) * transform2.d;
3967 if (view._boundsTransform)
3970 inverseBoundsTransform.tx -= view._inverseBoundsTransform.tx * transform2.a;
3971 inverseBoundsTransform.ty -= view._inverseBoundsTransform.ty * transform2.d;
3976 view = view._superview;
3979 transform2.tx = -transform2.tx;
3980 transform2.ty = -transform2.ty;
3982 if (view === fromView)
id initWithFrame:(CGRect aFrame)
Used to implement exception handling (creating & raising).
void viewDidMoveToSuperview()
void addSubview:(CPView aSubview)
void drawRect:(CGRect aRect)
void setAppearance:(CPAppearance anAppearance)
void postNotificationName:object:userInfo:(CPString aNotificationName, [object] id anObject, [userInfo] CPDictionary aUserInfo)
void scrollToPoint:(CGPoint aPoint)
An object representation of nil.
void setView:(CPView aValue)
BOOL autoscroll:(CPEvent anEvent)
function CPBrowserBackingStorePixelRatio(context)
var CPViewHasCustomLayoutSubviews
var CPViewPreviousKeyViewKey
void setFrame:(CGRect aFrame)
function CGContextRestoreGState(aContext)
void setCurrentContext:(CPGraphicsContext aGraphicsContext)
void raise:reason:(CPString aName, [reason] CPString aReason)
void removeFromSuperview()
BOOL enterFullScreenMode:withOptions:(CPScreen aScreen, [withOptions] CPDictionary options)
var CPViewHasCustomDrawRect
void setNeedsDisplayInRect:(CGRect aRect)
CPNotificationCenter defaultCenter()
CPInvalidArgumentException
A mutable key-value pair collection.
function ThemeState(stateNames)
void displayRectIgnoringOpacity:inContext:(CGRect aRect, [inContext] CPGraphicsContext aGraphicsContext)
void setBoundsOrigin:(CGPoint aPoint)
void displayRect:(CGRect aRect)
void setNeedsLayout:(BOOL needLayout)
id initWithContentRect:styleMask:(CGRect aContentRect, [styleMask] unsigned aStyleMask)
void viewWillMoveToSuperview:(CPView aView)
var CPViewAutoresizingMaskKey
CPView createEphemeralSubviewNamed:(CPString aViewName)
id initWithName:object:userInfo:(CPString aNotificationName, [object] id anObject, [userInfo] CPDictionary aUserInfo)
var CPViewTrackingAreasKey
An immutable string (collection of characters).
CGPoint convertPoint:fromView:(CGPoint aPoint, [fromView] CPView aView)
var CPViewBackgroundColorKey
void addSubview:positioned:relativeTo:(CPView aSubview, [positioned] CPWindowOrderingMode anOrderingMode, [relativeTo] CPView anotherView)
function CPFeatureIsCompatible(aFeature)
var CachedNotificationCenter
CGRect convertRect:toView:(CGRect aRect, [toView] CPView aView)
CPView nextValidKeyView()
void setHidden:(BOOL aFlag)
void setAutoresizingMask:(unsigned aMask)
void setNeedsDisplay:(BOOL aFlag)
CPGraphicsContext graphicsContextWithGraphicsPort:flipped:(CGContext aContext, [flipped] BOOL aFlag)
CPMenu menuForEvent:(CPEvent anEvent)
CGPoint convertPoint:toView:(CGPoint aPoint, [toView] CPView aView)
CPViewBoundsDidChangeNotification
function CGContextClearRect(aContext, aRect)
CPColor backgroundColor()
A notification that can be posted to a CPNotificationCenter.
CPInternalInconsistencyException
void setAlphaValue:(float anAlphaValue)
void orderOut:(id aSender)
CGRect convertRect:fromView:(CGRect aRect, [fromView] CPView aView)
void scaleUnitSquareToSize:(CGSize aSize)
CPAppearanceNameLightContent
CPAppearanceNameVibrantDark
global appkit_tag_dom_elements typedef _CPViewFullScreenModeState CPViewNotSizable
function CPBrowserStyleProperty(aProperty)
Defines methods for use when archiving & restoring (enc/decoding).
void updateTrackingAreas()
var CPViewHighDPIDrawingEnabled
CPThemeStateFirstResponder
function CGContextSaveGState(aContext)
Sends messages (CPNotification) between objects.
void setBounds:(CGRect bounds)
CGAffineTransform affineTransform()
void setBackgroundColor:(CPColor aColor)
void setBoundsSize:(CGSize aSize)
var CPViewAutoresizesSubviewsKey
void setFrameSize:(CGSize aSize)
CPOpacityRequiresFilterFeature
CPAppearanceNameVibrantLight
var CPViewHasCustomViewWillLayout
unsigned autoresizingMask()
CPPlatformWindow platformWindow()
function CPPlatformHasBug(aBug)
void exitFullScreenModeWithOptions:(CPDictionary options)
function CGBitmapGraphicsContextCreate()
CPWindowOrderingMode CPWindowAbove
void setFrameOrigin:(CGPoint aPoint)
void resizeSubviewsWithOldSize:(CGSize aSize)
CPViewFrameDidChangeNotification
CGRect rectForEphemeralSubviewNamed:(CPString aViewName)
BOOL isHiddenOrHasHiddenAncestor()
CPCanvasParentDrawErrorsOnMovementBug