annotate src/windows/native/sun/windows/awt_Frame.h @ 4084:6303d3a93040

7034291: Regression : Preedit String on active client is committed into unexpected component Reviewed-by: art, naoto
author dcherepanov
date Fri, 29 Apr 2011 16:02:05 +0400
parents 272483f6650b
children
rev   line source
duke@0 1 /*
ohair@3909 2 * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
ohair@2362 7 * published by the Free Software Foundation. Oracle designates this
duke@0 8 * particular file as subject to the "Classpath" exception as provided
ohair@2362 9 * by Oracle in the LICENSE file that accompanied this code.
duke@0 10 *
duke@0 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 15 * accompanied this code).
duke@0 16 *
duke@0 17 * You should have received a copy of the GNU General Public License version
duke@0 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 20 *
ohair@2362 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@2362 22 * or visit www.oracle.com if you need additional information or have any
ohair@2362 23 * questions.
duke@0 24 */
duke@0 25
duke@0 26 #ifndef AWT_FRAME_H
duke@0 27 #define AWT_FRAME_H
duke@0 28
duke@0 29 #include "awt_Window.h"
duke@0 30 #include "awt_MenuBar.h" //add for multifont
duke@0 31 #include "awt_Toolkit.h"
duke@0 32 #include "Hashtable.h"
duke@0 33
duke@0 34 #include "java_awt_Frame.h"
duke@0 35 #include "sun_awt_windows_WFramePeer.h"
duke@0 36
duke@0 37
duke@0 38 /************************************************************************
duke@0 39 * AwtFrame class
duke@0 40 */
duke@0 41
duke@0 42 #define AWT_FRAME_WINDOW_CLASS_NAME TEXT("SunAwtFrame")
duke@0 43
duke@0 44
duke@0 45 class AwtFrame : public AwtWindow {
duke@0 46 public:
duke@0 47 enum FrameExecIds {
duke@0 48 FRAME_SETMENUBAR
duke@0 49 };
duke@0 50
dcherepanov@1047 51 /* java.awt.Frame fields and method IDs */
dcherepanov@1047 52 static jfieldID undecoratedID;
dcherepanov@1047 53
dcherepanov@1047 54 /* sun.awt.windows.WEmbeddedFrame fields and method IDs */
duke@0 55 static jfieldID handleID;
duke@0 56
dcherepanov@1047 57 static jmethodID setExtendedStateMID;
dcherepanov@1047 58 static jmethodID getExtendedStateMID;
duke@0 59
duke@0 60 /* method id for WEmbeddedFrame.requestActivate() method */
duke@0 61 static jmethodID activateEmbeddingTopLevelMID;
duke@0 62
duke@0 63 AwtFrame();
duke@0 64 virtual ~AwtFrame();
duke@0 65
duke@0 66 virtual void Dispose();
duke@0 67
duke@0 68 virtual LPCTSTR GetClassName();
duke@0 69
duke@0 70 /* Create a new AwtFrame. This must be run on the main thread. */
duke@0 71 static AwtFrame* Create(jobject self, jobject parent);
duke@0 72
duke@0 73 /* Returns whether this frame is embedded in an external native frame. */
duke@0 74 INLINE BOOL IsEmbeddedFrame() { return m_isEmbedded; }
duke@0 75
duke@0 76 INLINE BOOL IsSimpleWindow() { return FALSE; }
duke@0 77
duke@0 78 /* Returns whether this window is in iconified state. */
duke@0 79 INLINE BOOL isIconic() { return m_iconic; }
duke@0 80 INLINE void setIconic(BOOL b) { m_iconic = b; }
duke@0 81
duke@0 82 /* Returns whether this window is in zoomed state. */
duke@0 83 INLINE BOOL isZoomed() { return m_zoomed; }
duke@0 84 INLINE void setZoomed(BOOL b) { m_zoomed = b; }
duke@0 85
duke@0 86 void SendWindowStateEvent(int oldState, int newState);
duke@0 87
duke@0 88 void Show();
duke@0 89
duke@0 90 INLINE void DrawMenuBar() { VERIFY(::DrawMenuBar(GetHWnd())); }
duke@0 91
duke@0 92 virtual void DoUpdateIcon();
duke@0 93 virtual HICON GetEffectiveIcon(int iconType);
duke@0 94
duke@0 95 /*for WmDrawItem and WmMeasureItem method */
duke@0 96 AwtMenuBar* GetMenuBar();
duke@0 97 void SetMenuBar(AwtMenuBar*);
duke@0 98
dcherepanov@3619 99 virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
dcherepanov@3619 100
duke@0 101 MsgRouting WmGetMinMaxInfo(LPMINMAXINFO lpmmi);
duke@0 102 MsgRouting WmSize(UINT type, int w, int h);
duke@0 103 MsgRouting WmActivate(UINT nState, BOOL fMinimized, HWND opposite);
duke@0 104 MsgRouting WmDrawItem(UINT ctrlId, DRAWITEMSTRUCT& drawInfo);
duke@0 105 MsgRouting WmMeasureItem(UINT ctrlId, MEASUREITEMSTRUCT& measureInfo);
duke@0 106 MsgRouting WmEnterMenuLoop(BOOL isTrackPopupMenu);
duke@0 107 MsgRouting WmExitMenuLoop(BOOL isTrackPopupMenu);
duke@0 108 MsgRouting WmMouseUp(UINT flags, int x, int y, int button);
duke@0 109 MsgRouting WmMouseMove(UINT flags, int x, int y);
duke@0 110 MsgRouting WmNcMouseDown(WPARAM hitTest, int x, int y, int button);
duke@0 111 MsgRouting WmNcMouseUp(WPARAM hitTest, int x, int y, int button);
duke@0 112 MsgRouting WmGetIcon(WPARAM iconType, LRESULT& retVal);
duke@0 113 MsgRouting WmShowWindow(BOOL show, UINT status);
duke@0 114
duke@0 115 virtual MsgRouting WmSysCommand(UINT uCmdType, int xPos, int yPos);
duke@0 116
duke@0 117 LRESULT WinThreadExecProc(ExecuteArgs * args);
duke@0 118
duke@0 119 INLINE BOOL IsUndecorated() { return m_isUndecorated; }
duke@0 120
duke@0 121 INLINE HWND GetProxyFocusOwner() {
dcherepanov@3619 122 return GetHWnd();
duke@0 123 }
duke@0 124
duke@0 125 void SetMaximizedBounds(int x, int y, int w, int h);
duke@0 126 void ClearMaximizedBounds();
duke@0 127
duke@0 128 // returns true if the frame is inputmethod window
duke@0 129 INLINE BOOL isInputMethodWindow() { return m_isInputMethodWindow; }
duke@0 130 // adjusts the IME candidate window position if needed
duke@0 131 void AdjustCandidateWindowPos();
duke@0 132
duke@0 133 // invoked on Toolkit thread
duke@0 134 static jobject _GetBoundsPrivate(void *param);
duke@0 135
duke@0 136 // some methods called on Toolkit thread
duke@0 137 static void _SetState(void *param);
duke@0 138 static jint _GetState(void *param);
duke@0 139 static void _SetMaximizedBounds(void *param);
duke@0 140 static void _ClearMaximizedBounds(void *param);
duke@0 141 static void _SetMenuBar(void *param);
duke@0 142 static void _SetIMMOption(void *param);
duke@0 143 static void _SynthesizeWmActivate(void *param);
duke@0 144 static void _NotifyModalBlocked(void *param);
duke@0 145
duke@0 146 virtual void Reshape(int x, int y, int width, int height);
duke@0 147
ant@1058 148 virtual BOOL AwtSetActiveWindow(BOOL isMouseEventCause = FALSE, UINT hittest = HTCLIENT);
ant@1058 149
ant@1058 150 void CheckRetainActualFocusedWindow(HWND activatedOpositeHWnd);
ant@1058 151 BOOL CheckActivateActualFocusedWindow(HWND deactivatedOpositeHWnd);
ant@1058 152
dcherepanov@4084 153 INLINE HWND GetImeTargetComponent() { return m_imeTargetComponent; }
dcherepanov@4084 154 INLINE void SetImeTargetComponent(HWND hwnd) { m_imeTargetComponent = hwnd; }
ant@1058 155
duke@0 156 protected:
duke@0 157 /* The frame is undecorated. */
duke@0 158 BOOL m_isUndecorated;
duke@0 159
duke@0 160 private:
dcherepanov@3619 161 LRESULT ProxyWindowProc(UINT message, WPARAM wParam, LPARAM lParam, MsgRouting &mr);
duke@0 162
duke@0 163 /* The frame's embedding parent (if any) */
duke@0 164 HWND m_parentWnd;
duke@0 165
duke@0 166 /* The frame's menubar. */
duke@0 167 AwtMenuBar* menuBar;
duke@0 168
duke@0 169 /* The frame is an EmbeddedFrame. */
duke@0 170 BOOL m_isEmbedded;
duke@0 171
duke@0 172 /* used so that calls to ::MoveWindow in SetMenuBar don't propogate
duke@0 173 because they are immediately followed by calls to Component.resize */
duke@0 174 BOOL m_ignoreWmSize;
duke@0 175
duke@0 176 /* tracks whether or not menu on this frame is dropped down */
duke@0 177 BOOL m_isMenuDropped;
duke@0 178
duke@0 179 /* The frame is an InputMethodWindow */
duke@0 180 BOOL m_isInputMethodWindow;
duke@0 181
dcherepanov@4084 182 // retains the target component for the IME messages
dcherepanov@4084 183 HWND m_imeTargetComponent;
ant@1058 184
duke@0 185 /*
duke@0 186 * Fix for 4823903.
duke@0 187 * Retains a focus proxied window to set the focus correctly
duke@0 188 * when its owner get activated.
duke@0 189 */
duke@0 190 AwtWindow *m_actualFocusedWindow;
duke@0 191
duke@0 192 /* The original, default WndProc for m_proxyFocusOwner. */
duke@0 193 WNDPROC m_proxyDefWindowProc;
duke@0 194
duke@0 195 BOOL m_iconic; /* are we in an iconic state */
duke@0 196 BOOL m_zoomed; /* are we in a zoomed state */
duke@0 197
duke@0 198 /* whether WmSize() must unconditionally reset zoomed state */
duke@0 199 BOOL m_forceResetZoomed;
duke@0 200
duke@0 201 BOOL m_maxBoundsSet;
duke@0 202 POINT m_maxPos;
duke@0 203 POINT m_maxSize;
duke@0 204
duke@0 205 BOOL isInManualMoveOrSize;
duke@0 206 WPARAM grabbedHitTest;
duke@0 207 POINT savedMousePos;
duke@0 208
duke@0 209 /*
duke@0 210 * Hashtable<Thread, BlockedThreadStruct> - a table that contains all the
duke@0 211 * information about non-toolkit threads with modal blocked embedded
duke@0 212 * frames. This information includes: number of blocked embedded frames
duke@0 213 * created on the the thread, and mouse and modal hooks installed for
duke@0 214 * that thread. For every thread each hook is installed only once
duke@0 215 */
duke@0 216 static Hashtable sm_BlockedThreads;
duke@0 217 };
duke@0 218
duke@0 219 #endif /* AWT_FRAME_H */