1 /*
2 * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
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 package sun.awt.windows;
26
27 import java.awt.*;
28 import java.awt.peer.*;
29
30 import sun.awt.*;
31 import sun.awt.im.*;
32
33 final class WDialogPeer extends WWindowPeer implements DialogPeer {
34 // Toolkit & peer internals
35
36 // Platform default background for dialogs. Gets set on target if
37 // target has none explicitly specified.
38 static final Color defaultBackground = SystemColor.control;
39
40 WDialogPeer(Dialog target) {
41 super(target);
42
43 InputMethodManager imm = InputMethodManager.getInstance();
44 String menuString = imm.getTriggerMenuString();
45 if (menuString != null)
46 {
47 pSetIMMOption(menuString);
48 }
49 }
50
51 native void createAwtDialog(WComponentPeer parent);
93 endModal();
94 } else {
95 super.hide();
96 }
97 }
98
99 @Override
100 public void blockWindows(java.util.List<Window> toBlock) {
101 for (Window w : toBlock) {
102 WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
103 if (wp != null) {
104 wp.setModalBlocked((Dialog)target, true);
105 }
106 }
107 }
108
109 @Override
110 public Dimension getMinimumSize() {
111 if (((Dialog)target).isUndecorated()) {
112 return super.getMinimumSize();
113 } else {
114 return new Dimension(getSysMinWidth(), getSysMinHeight());
115 }
116 }
117
118 @Override
119 boolean isTargetUndecorated() {
120 return ((Dialog)target).isUndecorated();
121 }
122
123 @Override
124 public void reshape(int x, int y, int width, int height) {
125 if (((Dialog)target).isUndecorated()) {
126 super.reshape(x, y, width, height);
127 } else {
128 reshapeFrame(x, y, width, height);
129 }
130 }
131
132 native void pSetIMMOption(String option);
133 void notifyIMMOptionChange(){
134 InputMethodManager.getInstance().notifyChangeRequest((Component)target);
135 }
|
1 /*
2 * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
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.awt.windows;
27
28 import java.awt.Color;
29 import java.awt.Component;
30 import java.awt.Dialog;
31 import java.awt.Dimension;
32 import java.awt.SystemColor;
33 import java.awt.Window;
34 import java.awt.peer.DialogPeer;
35
36 import sun.awt.AWTAccessor;
37 import sun.awt.im.InputMethodManager;
38
39 final class WDialogPeer extends WWindowPeer implements DialogPeer {
40 // Toolkit & peer internals
41
42 // Platform default background for dialogs. Gets set on target if
43 // target has none explicitly specified.
44 static final Color defaultBackground = SystemColor.control;
45
46 WDialogPeer(Dialog target) {
47 super(target);
48
49 InputMethodManager imm = InputMethodManager.getInstance();
50 String menuString = imm.getTriggerMenuString();
51 if (menuString != null)
52 {
53 pSetIMMOption(menuString);
54 }
55 }
56
57 native void createAwtDialog(WComponentPeer parent);
99 endModal();
100 } else {
101 super.hide();
102 }
103 }
104
105 @Override
106 public void blockWindows(java.util.List<Window> toBlock) {
107 for (Window w : toBlock) {
108 WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
109 if (wp != null) {
110 wp.setModalBlocked((Dialog)target, true);
111 }
112 }
113 }
114
115 @Override
116 public Dimension getMinimumSize() {
117 if (((Dialog)target).isUndecorated()) {
118 return super.getMinimumSize();
119 }
120 return new Dimension(scaleDownX(getSysMinWidth()),
121 scaleDownY(getSysMinHeight()));
122 }
123
124 @Override
125 boolean isTargetUndecorated() {
126 return ((Dialog)target).isUndecorated();
127 }
128
129 @Override
130 public void reshape(int x, int y, int width, int height) {
131 if (((Dialog)target).isUndecorated()) {
132 super.reshape(x, y, width, height);
133 } else {
134 reshapeFrame(x, y, width, height);
135 }
136 }
137
138 native void pSetIMMOption(String option);
139 void notifyIMMOptionChange(){
140 InputMethodManager.getInstance().notifyChangeRequest((Component)target);
141 }
|