author | xdono |
Wed, 02 Jul 2008 12:55:45 -0700 | |
changeset 715 | f16baef3a20e |
parent 129 | f995b9c9c5fa |
permissions | -rw-r--r-- |
2 | 1 |
/* |
715 | 2 |
* Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved. |
2 | 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. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
24 |
*/ |
|
25 |
package sun.awt.motif; |
|
26 |
||
27 |
import java.util.Vector; |
|
28 |
import java.awt.*; |
|
29 |
import java.awt.peer.*; |
|
30 |
import java.awt.event.*; |
|
31 |
import sun.awt.motif.MInputMethodControl; |
|
32 |
import sun.awt.im.*; |
|
33 |
||
34 |
class MDialogPeer extends MWindowPeer implements DialogPeer, MInputMethodControl { |
|
35 |
||
36 |
static Vector allDialogs = new Vector(); |
|
37 |
||
38 |
MDialogPeer(Dialog target) { |
|
39 |
||
40 |
/* create MWindowPeer object */ |
|
41 |
super(); |
|
42 |
||
43 |
winAttr.nativeDecor = !target.isUndecorated(); |
|
44 |
winAttr.initialFocus = true; |
|
45 |
winAttr.isResizable = target.isResizable(); |
|
46 |
winAttr.initialState = MWindowAttributes.NORMAL; |
|
47 |
winAttr.title = target.getTitle(); |
|
48 |
winAttr.icon = null; |
|
49 |
if (winAttr.nativeDecor) { |
|
50 |
winAttr.decorations = winAttr.AWT_DECOR_ALL | |
|
51 |
winAttr.AWT_DECOR_MINIMIZE | |
|
52 |
winAttr.AWT_DECOR_MAXIMIZE; |
|
53 |
} else { |
|
54 |
winAttr.decorations = winAttr.AWT_DECOR_NONE; |
|
55 |
} |
|
56 |
/* create and init native component */ |
|
57 |
init(target); |
|
58 |
allDialogs.addElement(this); |
|
59 |
} |
|
60 |
||
61 |
public void setTitle(String title) { |
|
62 |
pSetTitle(title); |
|
63 |
} |
|
64 |
||
65 |
protected void disposeImpl() { |
|
66 |
allDialogs.removeElement(this); |
|
67 |
super.disposeImpl(); |
|
68 |
} |
|
69 |
||
70 |
// NOTE: This method is called by privileged threads. |
|
71 |
// DO NOT INVOKE CLIENT CODE ON THIS THREAD! |
|
72 |
public void handleMoved(int x, int y) { |
|
73 |
postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED)); |
|
74 |
} |
|
75 |
||
76 |
public void show() { |
|
77 |
pShowModal( ((Dialog)target).isModal() ); |
|
78 |
updateAlwaysOnTop(alwaysOnTop); |
|
79 |
} |
|
80 |
||
81 |
||
82 |
// NOTE: This method may be called by privileged threads. |
|
83 |
// DO NOT INVOKE CLIENT CODE ON THIS THREAD! |
|
84 |
public void handleIconify() { |
|
85 |
// Note: These routines are necessary for Coaleseing of native implementations |
|
86 |
// As Dialogs do not currently send Iconify/DeIconify messages but |
|
87 |
// Windows/Frames do. If this should be made consistent...to do so |
|
88 |
// uncomment the postEvent. |
|
89 |
// postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_ICONIFIED)); |
|
90 |
} |
|
91 |
||
92 |
// NOTE: This method may be called by privileged threads. |
|
93 |
// DO NOT INVOKE CLIENT CODE ON THIS THREAD! |
|
94 |
public void handleDeiconify() { |
|
95 |
// Note: These routines are necessary for Coaleseing of native implementations |
|
96 |
// As Dialogs do not currently send Iconify/DeIconify messages but |
|
97 |
// Windows/Frames do. If this should be made consistent...to do so |
|
98 |
// uncomment the postEvent. |
|
99 |
// postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_DEICONIFIED)); |
|
100 |
} |
|
101 |
||
102 |
public void blockWindows(java.util.List<Window> toBlock) { |
|
103 |
// do nothing |
|
104 |
} |
|
129
f995b9c9c5fa
6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents:
2
diff
changeset
|
105 |
|
f995b9c9c5fa
6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents:
2
diff
changeset
|
106 |
@Override |
f995b9c9c5fa
6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents:
2
diff
changeset
|
107 |
final boolean isTargetUndecorated() { |
f995b9c9c5fa
6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents:
2
diff
changeset
|
108 |
return ((Dialog)target).isUndecorated(); |
f995b9c9c5fa
6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents:
2
diff
changeset
|
109 |
} |
2 | 110 |
} |