25 @class CPPlatformPasteboard
29 var PrimaryPlatformWindow = NULL;
37 unsigned _shadowStyle;
43 DOMElement _DOMBodyElement;
44 DOMElement _DOMFocusElement;
45 DOMElement _DOMEventGuard;
46 DOMElement _DOMScrollingElement;
47 id _hideDOMScrollingElementTimeout;
49 CPArray _windowLevels;
53 BOOL _mouseDownIsRightClick;
54 CGPoint _lastMouseEventLocation;
56 CPTimeInterval _lastMouseUp;
57 CPTimeInterval _lastMouseDown;
66 CPPlatformPasteboard _platformPasteboard;
72 + (CPSet)visiblePlatformWindows
77 + (BOOL)supportsMultipleInstances
88 return PrimaryPlatformWindow;
93 PrimaryPlatformWindow = aPlatformWindow;
96 - (id)initWithContentRect:(CGRect)aRect
102 _contentRect = CGRectMakeCopy(aRect);
117 return [
self initWithContentRect:CGRectMake(0.0, 0.0, 400.0, 500.0)];
120 - (CGRect)contentRect
122 return CGRectMakeCopy(_contentRect);
125 - (CGRect)contentBounds
127 var contentBounds = [
self contentRect];
129 contentBounds.origin = CGPointMakeZero();
131 return contentBounds;
134 - (CGRect)visibleFrame
136 var
frame = [
self contentBounds];
138 frame.origin = CGPointMakeZero();
142 var menuBarHeight = [[CPApp mainMenu] menuBarHeight];
144 frame.origin.y += menuBarHeight;
145 frame.size.height -= menuBarHeight;
151 - (CGRect)usableContentFrame
153 return [
self visibleFrame];
156 - (void)setContentRect:(CGRect)aRect
158 if (!aRect || CGRectEqualToRect(_contentRect, aRect))
161 _contentRect = CGRectMakeCopy(aRect);
164 [
self updateNativeContentRect];
168 - (void)updateFromNativeContentRect
170 [
self setContentRect:[
self nativeContentRect]];
173 - (CGPoint)convertBaseToScreen:(CGPoint)aPoint
175 var contentRect = [
self contentRect];
177 return CGPointMake(aPoint.x + CGRectGetMinX(contentRect), aPoint.y + CGRectGetMinY(contentRect));
180 - (CGPoint)convertScreenToBase:(CGPoint)aPoint
182 var contentRect = [
self contentRect];
184 return CGPointMake(aPoint.x - CGRectGetMinX(contentRect), aPoint.y - CGRectGetMinY(contentRect));
190 return _DOMWindow !== NULL;
196 - (void)deminiaturize:(
id)sender
199 if (_DOMWindow && typeof _DOMWindow[
"cpDeminiaturize"] ===
"function")
200 _DOMWindow.cpDeminiaturize();
204 - (void)miniaturize:(
id)sender
207 if (_DOMWindow && typeof _DOMWindow[
"cpMiniaturize"] ===
"function")
208 _DOMWindow.cpMiniaturize();
212 - (void)moveWindow:(
CPWindow)aWindow fromLevel:(
int)fromLevel toLevel:(
int)toLevel
215 if (!aWindow._isVisible)
218 var fromLayer = [
self layerAtLevel:fromLevel create:NO],
219 toLayer = [
self layerAtLevel:toLevel create:YES];
221 [fromLayer removeWindow:aWindow];
222 [toLayer insertWindow:aWindow atIndex:CPNotFound];
226 - (void)setLevel:(CPInteger)aLevel
231 if (_DOMWindow && _DOMWindow.cpSetLevel)
232 _DOMWindow.cpSetLevel(aLevel);
236 - (void)setHasShadow:(BOOL)shouldHaveShadow
238 _hasShadow = shouldHaveShadow;
241 if (_DOMWindow && _DOMWindow.cpSetHasShadow)
242 _DOMWindow.cpSetHasShadow(shouldHaveShadow);
246 - (void)setShadowStyle:(
int)aStyle
248 _shadowStyle = aStyle;
251 if (_DOMWindow && _DOMWindow.cpSetShadowStyle)
252 _shadowStyle.cpSetShadowStyle(aStyle);
256 - (BOOL)supportsFullPlatformWindows
267 _DOMWindow.document &&
268 ([aWindow isFullPlatformWindow]))
270 _DOMWindow.document.title = _title;
282 #if PLATFORM(BROWSER)