Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java
38827 views
/*1* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.lwawt;2627import java.awt.*;2829import sun.awt.CausedFocusEvent;30import sun.java2d.SurfaceData;3132// TODO Is it worth to generify this interface, like that:33//34// public interface PlatformWindow<WindowType extends Window>35//36// ?3738public interface PlatformWindow {3940/*41* Delegate initialization (create native window and all the42* related resources).43*/44public void initialize(Window target, LWWindowPeer peer, PlatformWindow owner);4546/*47* Delegate shutdown (dispose native window and all the48* related resources).49*/50public void dispose();5152/*53* Shows or hides the window.54*/55public void setVisible(boolean visible);5657/*58* Sets the window title59*/60public void setTitle(String title);6162/*63* Sets the window bounds. Called when user changes window bounds64* with setSize/setLocation/setBounds/reshape methods.65*/66public void setBounds(int x, int y, int w, int h);6768/*69* Returns the graphics device where the window is.70*/71public GraphicsDevice getGraphicsDevice();7273/*74* Returns the location of the window.75*/76public Point getLocationOnScreen();7778/*79* Returns the window insets.80*/81public Insets getInsets();8283/*84* Returns the metrics for a given font.85*/86public FontMetrics getFontMetrics(Font f);8788/*89* Get the SurfaceData for the window.90*/91public SurfaceData getScreenSurface();9293/*94* Revalidates the window's current SurfaceData and returns95* the newly created one.96*/97public SurfaceData replaceSurfaceData();9899public void setModalBlocked(boolean blocked);100101public void toFront();102103public void toBack();104105public void setMenuBar(MenuBar mb);106107public void setAlwaysOnTop(boolean value);108109public void updateFocusableWindowState();110111public boolean rejectFocusRequest(CausedFocusEvent.Cause cause);112113public boolean requestWindowFocus();114115/*116* Returns true only when called on a frame/dialog when it's natively focused.117*/118public boolean isActive();119120public void setResizable(boolean resizable);121122/**123* Applies the minimum and maximum size to the platform window.124*/125public void setSizeConstraints(int minW, int minH, int maxW, int maxH);126127/**128* Transforms the given Graphics object according to the native129* implementation traits (insets, etc.).130*/131public Graphics transformGraphics(Graphics g);132133/*134* Installs the images for particular window.135*/136public void updateIconImages();137138public void setOpacity(float opacity);139140public void setOpaque(boolean isOpaque);141142public void enterFullScreenMode();143144public void exitFullScreenMode();145146public boolean isFullScreenMode();147148public void setWindowState(int windowState);149150public long getLayerPtr();151152public LWWindowPeer getPeer();153154public boolean isUnderMouse();155}156157158