author | ohair |
Wed, 06 Apr 2011 22:06:11 -0700 | |
changeset 9035 | 1255eb81cc2f |
parent 8516 | 3406d5bc0ae2 |
child 9481 | fd8eab58a220 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
9035
1255eb81cc2f
7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents:
8516
diff
changeset
|
2 |
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
#ifndef AWT_FRAME_H |
|
27 |
#define AWT_FRAME_H |
|
28 |
||
29 |
#include "awt_Window.h" |
|
30 |
#include "awt_MenuBar.h" //add for multifont |
|
31 |
#include "awt_Toolkit.h" |
|
32 |
#include "Hashtable.h" |
|
33 |
||
34 |
#include "java_awt_Frame.h" |
|
35 |
#include "sun_awt_windows_WFramePeer.h" |
|
36 |
||
37 |
||
38 |
/************************************************************************ |
|
39 |
* AwtFrame class |
|
40 |
*/ |
|
41 |
||
42 |
#define AWT_FRAME_WINDOW_CLASS_NAME TEXT("SunAwtFrame") |
|
43 |
||
44 |
||
45 |
class AwtFrame : public AwtWindow { |
|
46 |
public: |
|
47 |
enum FrameExecIds { |
|
48 |
FRAME_SETMENUBAR |
|
49 |
}; |
|
50 |
||
2453
35e5fab82613
6724890: Deadlock between AWT-EventQueue-1 and AWT-XAWT threads during IDE start
dcherepanov
parents:
2
diff
changeset
|
51 |
/* java.awt.Frame fields and method IDs */ |
35e5fab82613
6724890: Deadlock between AWT-EventQueue-1 and AWT-XAWT threads during IDE start
dcherepanov
parents:
2
diff
changeset
|
52 |
static jfieldID undecoratedID; |
35e5fab82613
6724890: Deadlock between AWT-EventQueue-1 and AWT-XAWT threads during IDE start
dcherepanov
parents:
2
diff
changeset
|
53 |
|
35e5fab82613
6724890: Deadlock between AWT-EventQueue-1 and AWT-XAWT threads during IDE start
dcherepanov
parents:
2
diff
changeset
|
54 |
/* sun.awt.windows.WEmbeddedFrame fields and method IDs */ |
2 | 55 |
static jfieldID handleID; |
56 |
||
2453
35e5fab82613
6724890: Deadlock between AWT-EventQueue-1 and AWT-XAWT threads during IDE start
dcherepanov
parents:
2
diff
changeset
|
57 |
static jmethodID setExtendedStateMID; |
35e5fab82613
6724890: Deadlock between AWT-EventQueue-1 and AWT-XAWT threads during IDE start
dcherepanov
parents:
2
diff
changeset
|
58 |
static jmethodID getExtendedStateMID; |
2 | 59 |
|
60 |
/* method id for WEmbeddedFrame.requestActivate() method */ |
|
61 |
static jmethodID activateEmbeddingTopLevelMID; |
|
62 |
||
63 |
AwtFrame(); |
|
64 |
virtual ~AwtFrame(); |
|
65 |
||
66 |
virtual void Dispose(); |
|
67 |
||
68 |
virtual LPCTSTR GetClassName(); |
|
69 |
||
70 |
/* Create a new AwtFrame. This must be run on the main thread. */ |
|
71 |
static AwtFrame* Create(jobject self, jobject parent); |
|
72 |
||
73 |
/* Returns whether this frame is embedded in an external native frame. */ |
|
74 |
INLINE BOOL IsEmbeddedFrame() { return m_isEmbedded; } |
|
75 |
||
76 |
INLINE BOOL IsSimpleWindow() { return FALSE; } |
|
77 |
||
78 |
/* Returns whether this window is in iconified state. */ |
|
79 |
INLINE BOOL isIconic() { return m_iconic; } |
|
80 |
INLINE void setIconic(BOOL b) { m_iconic = b; } |
|
81 |
||
82 |
/* Returns whether this window is in zoomed state. */ |
|
83 |
INLINE BOOL isZoomed() { return m_zoomed; } |
|
84 |
INLINE void setZoomed(BOOL b) { m_zoomed = b; } |
|
85 |
||
86 |
void SendWindowStateEvent(int oldState, int newState); |
|
87 |
||
88 |
void Show(); |
|
89 |
||
90 |
INLINE void DrawMenuBar() { VERIFY(::DrawMenuBar(GetHWnd())); } |
|
91 |
||
92 |
virtual void DoUpdateIcon(); |
|
93 |
virtual HICON GetEffectiveIcon(int iconType); |
|
94 |
||
95 |
/*for WmDrawItem and WmMeasureItem method */ |
|
96 |
AwtMenuBar* GetMenuBar(); |
|
97 |
void SetMenuBar(AwtMenuBar*); |
|
98 |
||
8516
3406d5bc0ae2
6826397: PIT : Frame System Menu is not seen for when ALT + Space Bar is pressed in jdk7 b55 build.
dcherepanov
parents:
5506
diff
changeset
|
99 |
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); |
3406d5bc0ae2
6826397: PIT : Frame System Menu is not seen for when ALT + Space Bar is pressed in jdk7 b55 build.
dcherepanov
parents:
5506
diff
changeset
|
100 |
|
2 | 101 |
MsgRouting WmGetMinMaxInfo(LPMINMAXINFO lpmmi); |
102 |
MsgRouting WmSize(UINT type, int w, int h); |
|
103 |
MsgRouting WmActivate(UINT nState, BOOL fMinimized, HWND opposite); |
|
104 |
MsgRouting WmDrawItem(UINT ctrlId, DRAWITEMSTRUCT& drawInfo); |
|
105 |
MsgRouting WmMeasureItem(UINT ctrlId, MEASUREITEMSTRUCT& measureInfo); |
|
106 |
MsgRouting WmEnterMenuLoop(BOOL isTrackPopupMenu); |
|
107 |
MsgRouting WmExitMenuLoop(BOOL isTrackPopupMenu); |
|
108 |
MsgRouting WmMouseUp(UINT flags, int x, int y, int button); |
|
109 |
MsgRouting WmMouseMove(UINT flags, int x, int y); |
|
110 |
MsgRouting WmNcMouseDown(WPARAM hitTest, int x, int y, int button); |
|
111 |
MsgRouting WmNcMouseUp(WPARAM hitTest, int x, int y, int button); |
|
112 |
MsgRouting WmGetIcon(WPARAM iconType, LRESULT& retVal); |
|
113 |
MsgRouting WmShowWindow(BOOL show, UINT status); |
|
114 |
||
115 |
virtual MsgRouting WmSysCommand(UINT uCmdType, int xPos, int yPos); |
|
116 |
||
117 |
LRESULT WinThreadExecProc(ExecuteArgs * args); |
|
118 |
||
119 |
INLINE BOOL IsUndecorated() { return m_isUndecorated; } |
|
120 |
||
121 |
INLINE HWND GetProxyFocusOwner() { |
|
8516
3406d5bc0ae2
6826397: PIT : Frame System Menu is not seen for when ALT + Space Bar is pressed in jdk7 b55 build.
dcherepanov
parents:
5506
diff
changeset
|
122 |
return GetHWnd(); |
2 | 123 |
} |
124 |
||
125 |
void SetMaximizedBounds(int x, int y, int w, int h); |
|
126 |
void ClearMaximizedBounds(); |
|
127 |
||
128 |
// returns true if the frame is inputmethod window |
|
129 |
INLINE BOOL isInputMethodWindow() { return m_isInputMethodWindow; } |
|
130 |
// adjusts the IME candidate window position if needed |
|
131 |
void AdjustCandidateWindowPos(); |
|
132 |
||
133 |
// invoked on Toolkit thread |
|
134 |
static jobject _GetBoundsPrivate(void *param); |
|
135 |
||
136 |
// some methods called on Toolkit thread |
|
137 |
static void _SetState(void *param); |
|
138 |
static jint _GetState(void *param); |
|
139 |
static void _SetMaximizedBounds(void *param); |
|
140 |
static void _ClearMaximizedBounds(void *param); |
|
141 |
static void _SetMenuBar(void *param); |
|
142 |
static void _SetIMMOption(void *param); |
|
143 |
static void _SynthesizeWmActivate(void *param); |
|
144 |
static void _NotifyModalBlocked(void *param); |
|
145 |
||
146 |
virtual void Reshape(int x, int y, int width, int height); |
|
147 |
||
2464
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
148 |
virtual BOOL AwtSetActiveWindow(BOOL isMouseEventCause = FALSE, UINT hittest = HTCLIENT); |
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
149 |
|
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
150 |
void CheckRetainActualFocusedWindow(HWND activatedOpositeHWnd); |
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
151 |
BOOL CheckActivateActualFocusedWindow(HWND deactivatedOpositeHWnd); |
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
152 |
|
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
153 |
INLINE HWND GetLastProxiedFocusOwner() { return m_lastProxiedFocusOwner; } |
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
154 |
INLINE void SetLastProxiedFocusOwner(HWND hwnd) { m_lastProxiedFocusOwner = hwnd; } |
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
155 |
|
2 | 156 |
protected: |
157 |
/* The frame is undecorated. */ |
|
158 |
BOOL m_isUndecorated; |
|
159 |
||
160 |
private: |
|
8516
3406d5bc0ae2
6826397: PIT : Frame System Menu is not seen for when ALT + Space Bar is pressed in jdk7 b55 build.
dcherepanov
parents:
5506
diff
changeset
|
161 |
LRESULT ProxyWindowProc(UINT message, WPARAM wParam, LPARAM lParam, MsgRouting &mr); |
2 | 162 |
|
163 |
/* The frame's embedding parent (if any) */ |
|
164 |
HWND m_parentWnd; |
|
165 |
||
166 |
/* The frame's menubar. */ |
|
167 |
AwtMenuBar* menuBar; |
|
168 |
||
169 |
/* The frame is an EmbeddedFrame. */ |
|
170 |
BOOL m_isEmbedded; |
|
171 |
||
172 |
/* used so that calls to ::MoveWindow in SetMenuBar don't propogate |
|
173 |
because they are immediately followed by calls to Component.resize */ |
|
174 |
BOOL m_ignoreWmSize; |
|
175 |
||
176 |
/* tracks whether or not menu on this frame is dropped down */ |
|
177 |
BOOL m_isMenuDropped; |
|
178 |
||
179 |
/* The frame is an InputMethodWindow */ |
|
180 |
BOOL m_isInputMethodWindow; |
|
181 |
||
2464
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
182 |
/* Retains the last/current sm_focusOwner proxied. Actually, it should be |
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
183 |
* a component of an owned window last/currently active. */ |
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
184 |
HWND m_lastProxiedFocusOwner; |
3c6755bdc55f
6806217: implement synthetic focus model for MS Windows
ant
parents:
2453
diff
changeset
|
185 |
|
2 | 186 |
/* |
187 |
* Fix for 4823903. |
|
188 |
* Retains a focus proxied window to set the focus correctly |
|
189 |
* when its owner get activated. |
|
190 |
*/ |
|
191 |
AwtWindow *m_actualFocusedWindow; |
|
192 |
||
193 |
/* The original, default WndProc for m_proxyFocusOwner. */ |
|
194 |
WNDPROC m_proxyDefWindowProc; |
|
195 |
||
196 |
BOOL m_iconic; /* are we in an iconic state */ |
|
197 |
BOOL m_zoomed; /* are we in a zoomed state */ |
|
198 |
||
199 |
/* whether WmSize() must unconditionally reset zoomed state */ |
|
200 |
BOOL m_forceResetZoomed; |
|
201 |
||
202 |
BOOL m_maxBoundsSet; |
|
203 |
POINT m_maxPos; |
|
204 |
POINT m_maxSize; |
|
205 |
||
206 |
BOOL isInManualMoveOrSize; |
|
207 |
WPARAM grabbedHitTest; |
|
208 |
POINT savedMousePos; |
|
209 |
||
210 |
/* |
|
211 |
* Hashtable<Thread, BlockedThreadStruct> - a table that contains all the |
|
212 |
* information about non-toolkit threads with modal blocked embedded |
|
213 |
* frames. This information includes: number of blocked embedded frames |
|
214 |
* created on the the thread, and mouse and modal hooks installed for |
|
215 |
* that thread. For every thread each hook is installed only once |
|
216 |
*/ |
|
217 |
static Hashtable sm_BlockedThreads; |
|
218 |
}; |
|
219 |
||
220 |
#endif /* AWT_FRAME_H */ |