54 private static native void nativeSetNSWindowBounds(long nsWindowPtr, double x, double y, double w, double h); |
54 private static native void nativeSetNSWindowBounds(long nsWindowPtr, double x, double y, double w, double h); |
55 private static native void nativeSetNSWindowMinMax(long nsWindowPtr, double minW, double minH, double maxW, double maxH); |
55 private static native void nativeSetNSWindowMinMax(long nsWindowPtr, double minW, double minH, double maxW, double maxH); |
56 private static native void nativePushNSWindowToBack(long nsWindowPtr); |
56 private static native void nativePushNSWindowToBack(long nsWindowPtr); |
57 private static native void nativePushNSWindowToFront(long nsWindowPtr); |
57 private static native void nativePushNSWindowToFront(long nsWindowPtr); |
58 private static native void nativeSetNSWindowTitle(long nsWindowPtr, String title); |
58 private static native void nativeSetNSWindowTitle(long nsWindowPtr, String title); |
59 private static native void nativeSetNSWindowAlpha(long nsWindowPtr, float alpha); |
|
60 private static native void nativeRevalidateNSWindowShadow(long nsWindowPtr); |
59 private static native void nativeRevalidateNSWindowShadow(long nsWindowPtr); |
61 private static native void nativeSetNSWindowMinimizedIcon(long nsWindowPtr, long nsImage); |
60 private static native void nativeSetNSWindowMinimizedIcon(long nsWindowPtr, long nsImage); |
62 private static native void nativeSetNSWindowRepresentedFilename(long nsWindowPtr, String representedFilename); |
61 private static native void nativeSetNSWindowRepresentedFilename(long nsWindowPtr, String representedFilename); |
63 private static native void nativeSetNSWindowSecurityWarningPositioning(long nsWindowPtr, double x, double y, float biasX, float biasY); |
62 private static native void nativeSetNSWindowSecurityWarningPositioning(long nsWindowPtr, double x, double y, float biasX, float biasY); |
64 private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled); |
63 private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled); |
242 setPtr(nativeWindowPtr); |
241 setPtr(nativeWindowPtr); |
243 |
242 |
244 // TODO: implement on top of JObjC bridged class |
243 // TODO: implement on top of JObjC bridged class |
245 // NSWindow window = JObjC.getInstance().AppKit().NSWindow().getInstance(nativeWindowPtr, JObjCRuntime.getInstance()); |
244 // NSWindow window = JObjC.getInstance().AppKit().NSWindow().getInstance(nativeWindowPtr, JObjCRuntime.getInstance()); |
246 |
245 |
247 // Since JDK7 we have standard way to set opacity, so we should not pick |
|
248 // background's alpha. |
|
249 // TODO: set appropriate opacity value |
|
250 // this.opacity = target.getOpacity(); |
|
251 // this.setOpacity(this.opacity); |
|
252 |
|
253 final float windowAlpha = target.getOpacity(); |
|
254 if (windowAlpha != 1.0f) { |
|
255 nativeSetNSWindowAlpha(nativeWindowPtr, windowAlpha); |
|
256 } |
|
257 |
|
258 if (target instanceof javax.swing.RootPaneContainer) { |
246 if (target instanceof javax.swing.RootPaneContainer) { |
259 final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane(); |
247 final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane(); |
260 if (rootpane != null) rootpane.addPropertyChangeListener("ancestor", new PropertyChangeListener() { |
248 if (rootpane != null) rootpane.addPropertyChangeListener("ancestor", new PropertyChangeListener() { |
261 public void propertyChange(final PropertyChangeEvent evt) { |
249 public void propertyChange(final PropertyChangeEvent evt) { |
262 CLIENT_PROPERTY_APPLICATOR.attachAndApplyClientProperties(rootpane); |
250 CLIENT_PROPERTY_APPLICATOR.attachAndApplyClientProperties(rootpane); |
417 @Override // PlatformWindow |
405 @Override // PlatformWindow |
418 public void dispose() { |
406 public void dispose() { |
419 if (owner != null) { |
407 if (owner != null) { |
420 CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), getNSWindowPtr()); |
408 CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), getNSWindowPtr()); |
421 } |
409 } |
422 // Make sure window is ordered out before it is disposed, we could order it out right here or |
410 contentView.dispose(); |
423 // we could postpone the disposal, I think postponing is probably better. |
411 nativeDispose(getNSWindowPtr()); |
424 EventQueue.invokeLater(new Runnable() { |
412 CPlatformWindow.super.dispose(); |
425 public void run() { |
|
426 contentView.dispose(); |
|
427 nativeDispose(getNSWindowPtr()); |
|
428 CPlatformWindow.super.dispose(); |
|
429 } |
|
430 }); |
|
431 } |
413 } |
432 |
414 |
433 @Override // PlatformWindow |
415 @Override // PlatformWindow |
434 public void flip(int x1, int y1, int x2, int y2, FlipContents flipAction) { |
416 public void flip(int x1, int y1, int x2, int y2, FlipContents flipAction) { |
435 // TODO: not implemented |
417 // TODO: not implemented |