Alan Bateman | 3269d85 | 2012-03-06 20:34:38 +0000 | [diff] [blame] | 1 | /* |
Leonid Romanov | 2e97782 | 2013-03-27 16:37:00 +0400 | [diff] [blame^] | 2 | * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
Alan Bateman | 3269d85 | 2012-03-06 20:34:38 +0000 | [diff] [blame] | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Oracle designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Oracle in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 22 | * or visit www.oracle.com if you need additional information or have any |
| 23 | * questions. |
| 24 | */ |
| 25 | |
| 26 | package sun.lwawt; |
| 27 | |
| 28 | import java.awt.*; |
| 29 | |
Dmitry Cherepanov | 4fc6443 | 2012-03-21 14:31:29 +0400 | [diff] [blame] | 30 | import sun.awt.CausedFocusEvent; |
Alan Bateman | 3269d85 | 2012-03-06 20:34:38 +0000 | [diff] [blame] | 31 | import sun.java2d.SurfaceData; |
| 32 | |
| 33 | // TODO Is it worth to generify this interface, like that: |
| 34 | // |
| 35 | // public interface PlatformWindow<WindowType extends Window> |
| 36 | // |
| 37 | // ? |
| 38 | |
| 39 | public interface PlatformWindow { |
| 40 | |
| 41 | /* |
| 42 | * Delegate initialization (create native window and all the |
| 43 | * related resources). |
| 44 | */ |
| 45 | public void initialize(Window target, LWWindowPeer peer, PlatformWindow owner); |
| 46 | |
| 47 | /* |
| 48 | * Delegate shutdown (dispose native window and all the |
| 49 | * related resources). |
| 50 | */ |
| 51 | public void dispose(); |
| 52 | |
| 53 | /* |
| 54 | * Shows or hides the window. |
| 55 | */ |
| 56 | public void setVisible(boolean visible); |
| 57 | |
| 58 | /* |
| 59 | * Sets the window title |
| 60 | */ |
| 61 | public void setTitle(String title); |
| 62 | |
| 63 | /* |
| 64 | * Sets the window bounds. Called when user changes window bounds |
| 65 | * with setSize/setLocation/setBounds/reshape methods. |
| 66 | */ |
| 67 | public void setBounds(int x, int y, int w, int h); |
| 68 | |
| 69 | /* |
Dmitry Cherepanov | e054554 | 2012-05-22 12:35:55 +0400 | [diff] [blame] | 70 | * Returns the graphics device where the window is. |
Alan Bateman | 3269d85 | 2012-03-06 20:34:38 +0000 | [diff] [blame] | 71 | */ |
Dmitry Cherepanov | e054554 | 2012-05-22 12:35:55 +0400 | [diff] [blame] | 72 | public GraphicsDevice getGraphicsDevice(); |
Alan Bateman | 3269d85 | 2012-03-06 20:34:38 +0000 | [diff] [blame] | 73 | |
| 74 | /* |
| 75 | * Returns the location of the window. |
| 76 | */ |
| 77 | public Point getLocationOnScreen(); |
| 78 | |
| 79 | /* |
| 80 | * Returns the window insets. |
| 81 | */ |
| 82 | public Insets getInsets(); |
| 83 | |
| 84 | /* |
| 85 | * Returns the metrics for a given font. |
| 86 | */ |
| 87 | public FontMetrics getFontMetrics(Font f); |
| 88 | |
| 89 | /* |
| 90 | * Get the SurfaceData for the window. |
| 91 | */ |
| 92 | public SurfaceData getScreenSurface(); |
| 93 | |
| 94 | /* |
| 95 | * Revalidates the window's current SurfaceData and returns |
| 96 | * the newly created one. |
| 97 | */ |
| 98 | public SurfaceData replaceSurfaceData(); |
| 99 | |
Leonid Romanov | e6869ed | 2012-05-03 19:22:38 +0400 | [diff] [blame] | 100 | public void setModalBlocked(boolean blocked); |
| 101 | |
Alan Bateman | 3269d85 | 2012-03-06 20:34:38 +0000 | [diff] [blame] | 102 | public void toFront(); |
| 103 | |
| 104 | public void toBack(); |
| 105 | |
| 106 | public void setMenuBar(MenuBar mb); |
| 107 | |
| 108 | public void setAlwaysOnTop(boolean value); |
| 109 | |
Alexander Scherbatiy | 31ec802 | 2012-08-29 15:54:28 +0400 | [diff] [blame] | 110 | public PlatformWindow getTopmostPlatformWindowUnderMouse(); |
| 111 | |
Alan Bateman | 3269d85 | 2012-03-06 20:34:38 +0000 | [diff] [blame] | 112 | public void updateFocusableWindowState(); |
| 113 | |
Dmitry Cherepanov | 4fc6443 | 2012-03-21 14:31:29 +0400 | [diff] [blame] | 114 | public boolean rejectFocusRequest(CausedFocusEvent.Cause cause); |
| 115 | |
Alan Bateman | 3269d85 | 2012-03-06 20:34:38 +0000 | [diff] [blame] | 116 | public boolean requestWindowFocus(); |
| 117 | |
| 118 | /* |
| 119 | * Returns true only when called on a frame/dialog when it's natively focused. |
| 120 | */ |
| 121 | public boolean isActive(); |
| 122 | |
| 123 | public void setResizable(boolean resizable); |
| 124 | |
Anthony Petrov | ed711d4 | 2012-08-24 14:58:04 +0400 | [diff] [blame] | 125 | /** |
| 126 | * Applies the minimum and maximum size to the platform window. |
| 127 | */ |
| 128 | public void setSizeConstraints(int minW, int minH, int maxW, int maxH); |
Alan Bateman | 3269d85 | 2012-03-06 20:34:38 +0000 | [diff] [blame] | 129 | |
| 130 | /** |
| 131 | * Transforms the given Graphics object according to the native |
| 132 | * implementation traits (insets, etc.). |
| 133 | */ |
| 134 | public Graphics transformGraphics(Graphics g); |
| 135 | |
| 136 | /* |
| 137 | * Installs the images for particular window. |
| 138 | */ |
| 139 | public void updateIconImages(); |
| 140 | |
| 141 | public void setOpacity(float opacity); |
| 142 | |
| 143 | public void setOpaque(boolean isOpaque); |
| 144 | |
| 145 | public void enterFullScreenMode(); |
| 146 | |
| 147 | public void exitFullScreenMode(); |
| 148 | |
Leonid Romanov | 2e97782 | 2013-03-27 16:37:00 +0400 | [diff] [blame^] | 149 | public boolean isFullScreenMode(); |
| 150 | |
Alan Bateman | 3269d85 | 2012-03-06 20:34:38 +0000 | [diff] [blame] | 151 | public void setWindowState(int windowState); |
| 152 | |
| 153 | public long getLayerPtr(); |
| 154 | |
| 155 | public LWWindowPeer getPeer(); |
Petr Pchelko | c745a7e | 2012-12-11 19:45:00 +0400 | [diff] [blame] | 156 | |
| 157 | public boolean isUnderMouse(); |
Alan Bateman | 3269d85 | 2012-03-06 20:34:38 +0000 | [diff] [blame] | 158 | } |