Path: blob/master/src/java.desktop/macosx/classes/sun/lwawt/PlatformWindow.java
41153 views
/*1* Copyright (c) 2011, 2016, 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.*;28import java.awt.event.FocusEvent;2930import 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* Sets the maximized bounds.70*/71public default void setMaximizedBounds(int x, int y, int w, int h){}7273/*74* Returns the graphics device where the window is.75*/76public GraphicsDevice getGraphicsDevice();7778/*79* Returns the location of the window.80*/81public Point getLocationOnScreen();8283/*84* Returns the window insets.85*/86public Insets getInsets();8788/*89* Returns the metrics for a given font.90*/91public FontMetrics getFontMetrics(Font f);9293/*94* Get the SurfaceData for the window.95*/96public SurfaceData getScreenSurface();9798/*99* Revalidates the window's current SurfaceData and returns100* the newly created one.101*/102public SurfaceData replaceSurfaceData();103104public void setModalBlocked(boolean blocked);105106public void toFront();107108public void toBack();109110public void setMenuBar(MenuBar mb);111112public void setAlwaysOnTop(boolean value);113114public void updateFocusableWindowState();115116public boolean rejectFocusRequest(FocusEvent.Cause cause);117118public boolean requestWindowFocus();119120/*121* Returns true only when called on a frame/dialog when it's natively focused.122*/123public boolean isActive();124125public void setResizable(boolean resizable);126127/**128* Applies the minimum and maximum size to the platform window.129*/130public void setSizeConstraints(int minW, int minH, int maxW, int maxH);131132/*133* Installs the images for particular window.134*/135public void updateIconImages();136137public void setOpacity(float opacity);138139public void setOpaque(boolean isOpaque);140141public void enterFullScreenMode();142143public void exitFullScreenMode();144145public boolean isFullScreenMode();146147public void setWindowState(int windowState);148149public long getLayerPtr();150151public LWWindowPeer getPeer();152153public boolean isUnderMouse();154}155156157