mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-03 03:24:22 +00:00
Make the new cursor stuff work across platform windows
This commit is contained in:
1 parent
20a38c3aac
commit
2351f73c76
3 files changed
+34
-4
No files matched your search
+13
-4
@@ -31,8 +31,9 @@ var currentCursor = nil,
|
||||
|
||||
- (id)initWithCSSString:(CPString)aString
|
||||
{
|
||||
self = [super init];
|
||||
_cssString = aString;
|
||||
if (self = [super init])
|
||||
_cssString = aString;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -218,6 +219,13 @@ var currentCursor = nil,
|
||||
{
|
||||
document.body.style.cursor = _cssString;
|
||||
currentCursor = self;
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
var platformWindows = [[CPPlatformWindow platformWindows] allObjects];
|
||||
for (var i = 0, count = [platformWindows count]; i < count; i++)
|
||||
platformWindows[i]._DOMWindow.document.body.style.cursor = _cssString;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
- (void)push
|
||||
@@ -241,8 +249,9 @@ var currentCursor = nil,
|
||||
|
||||
- (id)initWithCoder:(CPCoder)coder
|
||||
{
|
||||
self = [super init];
|
||||
_cssString = [coder decodeObjectForKey:@"CPCursorNameKey"];
|
||||
if (self = [super init])
|
||||
_cssString = [coder decodeObjectForKey:@"CPCursorNameKey"];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,11 @@ var PrimaryPlatformWindow = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (CPSet)visiblePlatformWindows
|
||||
{
|
||||
return [CPSet set];
|
||||
}
|
||||
|
||||
+ (CPPlatformWindow)primaryPlatformWindow
|
||||
{
|
||||
return PrimaryPlatformWindow;
|
||||
|
||||
@@ -121,6 +121,9 @@
|
||||
|
||||
#import "../../CoreGraphics/CGGeometry.h"
|
||||
|
||||
// List of all open native windows
|
||||
var PlatformWindows = [CPSet set];
|
||||
|
||||
// Define up here so compressor knows about em.
|
||||
var CPDOMEventGetClickCount,
|
||||
CPDOMEventStop,
|
||||
@@ -358,6 +361,8 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
|
||||
|
||||
//_DOMWindow.removeEventListener("beforeunload", this, NO);
|
||||
|
||||
[PlatformWindows removeObject:self];
|
||||
|
||||
self._DOMWindow = nil;
|
||||
}, NO);
|
||||
}
|
||||
@@ -404,11 +409,18 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
|
||||
|
||||
//_DOMWindow.removeEvent("beforeunload", this);
|
||||
|
||||
[PlatformWindows removeObject:self];
|
||||
|
||||
self._DOMWindow = nil;
|
||||
}, NO);
|
||||
}
|
||||
}
|
||||
|
||||
+ (CPSet)visiblePlatformWindows
|
||||
{
|
||||
return PlatformWindows;
|
||||
}
|
||||
|
||||
- (void)orderFront:(id)aSender
|
||||
{
|
||||
if (_DOMWindow)
|
||||
@@ -416,6 +428,8 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
|
||||
|
||||
_DOMWindow = window.open("", "_blank", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no,left=" + _CGRectGetMinX(_contentRect) + ",top=" + _CGRectGetMinY(_contentRect) + ",width=" + _CGRectGetWidth(_contentRect) + ",height=" + _CGRectGetHeight(_contentRect));
|
||||
|
||||
[PlatformWindows addObject:self];
|
||||
|
||||
// FIXME: cpSetFrame?
|
||||
_DOMWindow.document.write("<html><head></head><body style = 'background-color:transparent;'></body></html>");
|
||||
_DOMWindow.document.close();
|
||||
@@ -429,6 +443,8 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
|
||||
_DOMWindow.cpSetShadowStyle(_shadowStyle);
|
||||
}
|
||||
|
||||
_DOMWindow.document.body.style.cursor = [[CPCursor currentCursor] _cssString];
|
||||
|
||||
[self registerDOMWindow];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user