blob: 0e3be9d81a122c03daaffa951263ee2e98eb09cf [file] [log] [blame]
Alan Bateman3269d852012-03-06 20:34:38 +00001/*
Semyon Sadetsky40685b42016-04-15 09:46:31 +03002 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
Alan Bateman3269d852012-03-06 20:34:38 +00003 * 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
26package sun.lwawt;
27
28import java.awt.*;
Semyon Sadetsky40685b42016-04-15 09:46:31 +030029import java.awt.event.FocusEvent;
Alan Bateman3269d852012-03-06 20:34:38 +000030
31import 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
39public 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 /*
Alexander Scherbatiy83dcd682015-05-22 15:19:05 +040070 * Sets the maximized bounds.
71 */
72 public default void setMaximizedBounds(int x, int y, int w, int h){}
73
74 /*
Dmitry Cherepanove0545542012-05-22 12:35:55 +040075 * Returns the graphics device where the window is.
Alan Bateman3269d852012-03-06 20:34:38 +000076 */
Dmitry Cherepanove0545542012-05-22 12:35:55 +040077 public GraphicsDevice getGraphicsDevice();
Alan Bateman3269d852012-03-06 20:34:38 +000078
79 /*
80 * Returns the location of the window.
81 */
82 public Point getLocationOnScreen();
83
84 /*
85 * Returns the window insets.
86 */
87 public Insets getInsets();
88
89 /*
90 * Returns the metrics for a given font.
91 */
92 public FontMetrics getFontMetrics(Font f);
93
94 /*
95 * Get the SurfaceData for the window.
96 */
97 public SurfaceData getScreenSurface();
98
99 /*
100 * Revalidates the window's current SurfaceData and returns
101 * the newly created one.
102 */
103 public SurfaceData replaceSurfaceData();
104
Leonid Romanove6869ed2012-05-03 19:22:38 +0400105 public void setModalBlocked(boolean blocked);
106
Alan Bateman3269d852012-03-06 20:34:38 +0000107 public void toFront();
108
109 public void toBack();
110
111 public void setMenuBar(MenuBar mb);
112
113 public void setAlwaysOnTop(boolean value);
114
115 public void updateFocusableWindowState();
116
Semyon Sadetsky40685b42016-04-15 09:46:31 +0300117 public boolean rejectFocusRequest(FocusEvent.Cause cause);
Dmitry Cherepanov4fc64432012-03-21 14:31:29 +0400118
Alan Bateman3269d852012-03-06 20:34:38 +0000119 public boolean requestWindowFocus();
120
121 /*
122 * Returns true only when called on a frame/dialog when it's natively focused.
123 */
124 public boolean isActive();
125
126 public void setResizable(boolean resizable);
127
Anthony Petroved711d42012-08-24 14:58:04 +0400128 /**
129 * Applies the minimum and maximum size to the platform window.
130 */
131 public void setSizeConstraints(int minW, int minH, int maxW, int maxH);
Alan Bateman3269d852012-03-06 20:34:38 +0000132
Alan Bateman3269d852012-03-06 20:34:38 +0000133 /*
134 * Installs the images for particular window.
135 */
136 public void updateIconImages();
137
138 public void setOpacity(float opacity);
139
140 public void setOpaque(boolean isOpaque);
141
142 public void enterFullScreenMode();
143
144 public void exitFullScreenMode();
145
Leonid Romanov2e977822013-03-27 16:37:00 +0400146 public boolean isFullScreenMode();
147
Alan Bateman3269d852012-03-06 20:34:38 +0000148 public void setWindowState(int windowState);
149
150 public long getLayerPtr();
151
152 public LWWindowPeer getPeer();
Petr Pchelkoc745a7e2012-12-11 19:45:00 +0400153
154 public boolean isUnderMouse();
Alan Bateman3269d852012-03-06 20:34:38 +0000155}