1998-04-13 20:24:54 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-04-13 20:24:54 +00:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 03:40:37 +00:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2000-03-21 03:42:00 +00:00
|
|
|
* Robert O'Callahan <roc+moz@cs.cmu.edu>
|
2001-03-14 02:34:46 +00:00
|
|
|
* Dean Tessman <dean_tessman@hotmail.com>
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
2000-03-21 03:42:00 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
#ifndef Window_h__
|
|
|
|
#define Window_h__
|
|
|
|
|
1998-09-23 19:19:23 +00:00
|
|
|
#include "nsBaseWidget.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsdefs.h"
|
|
|
|
#include "nsSwitchToUIThread.h"
|
|
|
|
#include "nsToolkit.h"
|
|
|
|
|
|
|
|
#include "nsIWidget.h"
|
1999-11-15 20:57:41 +00:00
|
|
|
#include "nsIKBStateControl.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
#include "nsIMouseListener.h"
|
|
|
|
#include "nsIEventListener.h"
|
1998-04-17 23:45:07 +00:00
|
|
|
#include "nsStringUtil.h"
|
|
|
|
#include "nsString.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-08-13 23:01:01 +00:00
|
|
|
#include "nsVoidArray.h"
|
|
|
|
|
1999-04-06 20:23:55 +00:00
|
|
|
class nsNativeDragTarget;
|
1999-09-21 11:25:03 +00:00
|
|
|
class nsIRollupListener;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2000-01-31 22:53:35 +00:00
|
|
|
class nsIMenuBar;
|
|
|
|
|
2001-08-17 03:13:07 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
struct IAccessible;
|
2001-04-17 23:06:38 +00:00
|
|
|
#include "nsIAccessible.h"
|
|
|
|
#include "nsIAccessibleEventListener.h"
|
2001-08-17 03:13:07 +00:00
|
|
|
#endif
|
2001-04-17 23:06:38 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
#define NSRGB_2_COLOREF(color) \
|
|
|
|
RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color))
|
2001-05-25 14:48:31 +00:00
|
|
|
#define COLOREF_2_NSRGB(color) \
|
|
|
|
NS_RGB(GetRValue(color), GetGValue(color), GetBValue(color))
|
1999-03-12 00:21:11 +00:00
|
|
|
|
2000-09-22 01:06:51 +00:00
|
|
|
/**
|
|
|
|
* Native IMM wrapper
|
|
|
|
*/
|
|
|
|
class nsIMM
|
|
|
|
{
|
|
|
|
//prototypes for DLL function calls...
|
|
|
|
typedef LONG (CALLBACK *GetCompStrPtr) (HIMC,DWORD,LPVOID,DWORD);
|
|
|
|
typedef LONG (CALLBACK *GetContextPtr) (HWND);
|
|
|
|
typedef LONG (CALLBACK *RelContextPtr) (HWND,HIMC);
|
|
|
|
typedef LONG (CALLBACK *GetCStatusPtr) (HIMC,LPDWORD,LPDWORD);
|
|
|
|
typedef LONG (CALLBACK *SetCStatusPtr) (HIMC,DWORD,DWORD);
|
|
|
|
typedef LONG (CALLBACK *NotifyIMEPtr) (HIMC,DWORD,DWORD,DWORD);
|
|
|
|
typedef LONG (CALLBACK *SetCandWindowPtr) (HIMC,LPCANDIDATEFORM);
|
|
|
|
typedef LONG (CALLBACK *GetCompWindowPtr) (HIMC,LPCOMPOSITIONFORM);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
static nsIMM& LoadModule() {
|
|
|
|
static nsIMM gIMM;
|
|
|
|
return gIMM;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIMM(const char* aModuleName="IMM32.DLL") {
|
|
|
|
mInstance=::LoadLibrary(aModuleName);
|
|
|
|
NS_ASSERTION(mInstance!=NULL,"nsIMM.LoadLibrary failed.");
|
|
|
|
|
|
|
|
mGetCompositionStringA=(mInstance) ? (GetCompStrPtr)GetProcAddress(mInstance,"ImmGetCompositionStringA") : 0;
|
|
|
|
NS_ASSERTION(mGetCompositionStringA!=NULL,"nsIMM.ImmGetCompositionStringA failed.");
|
|
|
|
|
|
|
|
mGetCompositionStringW=(mInstance) ? (GetCompStrPtr)GetProcAddress(mInstance,"ImmGetCompositionStringW") : 0;
|
|
|
|
NS_ASSERTION(mGetCompositionStringW!=NULL,"nsIMM.ImmGetCompositionStringW failed.");
|
|
|
|
|
|
|
|
mGetContext=(mInstance) ? (GetContextPtr)GetProcAddress(mInstance,"ImmGetContext") : 0;
|
|
|
|
NS_ASSERTION(mGetContext!=NULL,"nsIMM.ImmGetContext failed.");
|
|
|
|
|
|
|
|
mReleaseContext=(mInstance) ? (RelContextPtr)GetProcAddress(mInstance,"ImmReleaseContext") : 0;
|
|
|
|
NS_ASSERTION(mReleaseContext!=NULL,"nsIMM.ImmReleaseContext failed.");
|
|
|
|
|
|
|
|
mGetConversionStatus=(mInstance) ? (GetCStatusPtr)GetProcAddress(mInstance,"ImmGetConversionStatus") : 0;
|
|
|
|
NS_ASSERTION(mGetConversionStatus!=NULL,"nsIMM.ImmGetConversionStatus failed.");
|
|
|
|
|
|
|
|
mSetConversionStatus=(mInstance) ? (SetCStatusPtr)GetProcAddress(mInstance,"ImmSetConversionStatus") : 0;
|
|
|
|
NS_ASSERTION(mSetConversionStatus!=NULL,"nsIMM.ImmSetConversionStatus failed.");
|
|
|
|
|
|
|
|
mNotifyIME=(mInstance) ? (NotifyIMEPtr)GetProcAddress(mInstance,"ImmNotifyIME") : 0;
|
|
|
|
NS_ASSERTION(mNotifyIME!=NULL,"nsIMM.ImmNotifyIME failed.");
|
|
|
|
|
|
|
|
mSetCandiateWindow=(mInstance) ? (SetCandWindowPtr)GetProcAddress(mInstance,"ImmSetCandidateWindow") : 0;
|
|
|
|
NS_ASSERTION(mSetCandiateWindow!=NULL,"nsIMM.ImmSetCandidateWindow failed.");
|
|
|
|
|
|
|
|
mGetCompositionWindow=(mInstance) ? (GetCompWindowPtr)GetProcAddress(mInstance,"ImmGetCompositionWindow") : 0;
|
|
|
|
NS_ASSERTION(mGetCompositionWindow!=NULL,"nsIMM.ImmGetCompositionWindow failed.");
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsIMM() {
|
|
|
|
if(mInstance) {
|
|
|
|
::FreeLibrary(mInstance);
|
|
|
|
}
|
|
|
|
mGetCompositionStringA= 0;
|
|
|
|
mGetCompositionStringW= 0;
|
|
|
|
mGetContext=0;
|
|
|
|
mReleaseContext=0;
|
|
|
|
mGetConversionStatus=0;
|
|
|
|
mSetConversionStatus=0;
|
|
|
|
mNotifyIME=0;
|
|
|
|
mSetCandiateWindow=0;
|
|
|
|
mGetCompositionWindow=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG GetCompositionStringA(HIMC h,DWORD d1,LPVOID v,DWORD d2) {
|
|
|
|
return (mGetCompositionStringA) ? mGetCompositionStringA(h,d1,v,d2) : 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG GetCompositionStringW(HIMC h,DWORD d1,LPVOID v,DWORD d2) {
|
|
|
|
return (mGetCompositionStringW) ? mGetCompositionStringW(h,d1,v,d2) : 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG GetContext(HWND anHWND) {
|
|
|
|
return (mGetContext) ? mGetContext(anHWND) : 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG ReleaseContext(HWND anHWND,HIMC anIMC) {
|
|
|
|
return (mReleaseContext) ? mReleaseContext(anHWND,anIMC) : 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG GetConversionStatus(HIMC h, LPDWORD w1, LPDWORD w2) {
|
|
|
|
return (mGetConversionStatus) ? mGetConversionStatus(h,w1,w2) : 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG SetConversionStatus(HIMC h,DWORD d1,DWORD d2) {
|
|
|
|
return (mSetConversionStatus) ? mSetConversionStatus(h,d1,d2) : 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG NotifyIME(HIMC h,DWORD d1,DWORD d2,DWORD d3) {
|
|
|
|
return (mNotifyIME) ? mNotifyIME(h,d1,d2,d3) : 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG SetCandidateWindow(HIMC h,LPCANDIDATEFORM l) {
|
|
|
|
return (mSetCandiateWindow) ? mSetCandiateWindow(h,l) : 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG GetCompositionWindow(HIMC h,LPCOMPOSITIONFORM l) {
|
|
|
|
return (mGetCompositionWindow) ? mGetCompositionWindow(h,l) : 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
HINSTANCE mInstance;
|
|
|
|
GetCompStrPtr mGetCompositionStringA;
|
|
|
|
GetCompStrPtr mGetCompositionStringW;
|
|
|
|
GetContextPtr mGetContext;
|
|
|
|
RelContextPtr mReleaseContext;
|
|
|
|
GetCStatusPtr mGetConversionStatus;
|
|
|
|
SetCStatusPtr mSetConversionStatus;
|
|
|
|
NotifyIMEPtr mNotifyIME;
|
|
|
|
SetCandWindowPtr mSetCandiateWindow;
|
|
|
|
GetCompWindowPtr mGetCompositionWindow;
|
|
|
|
};
|
|
|
|
|
1998-04-14 23:20:49 +00:00
|
|
|
/**
|
|
|
|
* Native WIN32 window wrapper.
|
|
|
|
*/
|
|
|
|
|
1999-04-19 19:04:12 +00:00
|
|
|
class nsWindow : public nsSwitchToUIThread,
|
1999-11-15 20:57:41 +00:00
|
|
|
public nsBaseWidget,
|
|
|
|
public nsIKBStateControl
|
2001-04-17 23:06:38 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
1998-09-14 20:40:49 +00:00
|
|
|
nsWindow();
|
|
|
|
virtual ~nsWindow();
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-11-15 20:57:41 +00:00
|
|
|
// nsISupports
|
|
|
|
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
|
|
|
NS_IMETHOD_(nsrefcnt) Release(void);
|
|
|
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
// nsIWidget interface
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD Create(nsIWidget *aParent,
|
1998-04-13 20:24:54 +00:00
|
|
|
const nsRect &aRect,
|
|
|
|
EVENT_CALLBACK aHandleEventFunction,
|
|
|
|
nsIDeviceContext *aContext,
|
1998-07-29 18:51:45 +00:00
|
|
|
nsIAppShell *aAppShell = nsnull,
|
1998-04-24 21:37:30 +00:00
|
|
|
nsIToolkit *aToolkit = nsnull,
|
1998-05-14 21:34:08 +00:00
|
|
|
nsWidgetInitData *aInitData = nsnull);
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD Create(nsNativeWidget aParent,
|
1998-04-13 20:24:54 +00:00
|
|
|
const nsRect &aRect,
|
|
|
|
EVENT_CALLBACK aHandleEventFunction,
|
|
|
|
nsIDeviceContext *aContext,
|
1998-07-29 18:51:45 +00:00
|
|
|
nsIAppShell *aAppShell = nsnull,
|
1998-04-24 21:37:30 +00:00
|
|
|
nsIToolkit *aToolkit = nsnull,
|
1998-05-14 21:34:08 +00:00
|
|
|
nsWidgetInitData *aInitData = nsnull);
|
1998-09-23 19:19:23 +00:00
|
|
|
|
1998-09-29 21:34:58 +00:00
|
|
|
// Utility method for implementing both Create(nsIWidget ...) and
|
|
|
|
// Create(nsNativeWidget...)
|
|
|
|
|
|
|
|
virtual nsresult StandardWindowCreate(nsIWidget *aParent,
|
|
|
|
const nsRect &aRect,
|
|
|
|
EVENT_CALLBACK aHandleEventFunction,
|
|
|
|
nsIDeviceContext *aContext,
|
|
|
|
nsIAppShell *aAppShell,
|
|
|
|
nsIToolkit *aToolkit,
|
|
|
|
nsWidgetInitData *aInitData,
|
|
|
|
nsNativeWidget aNativeParent = nsnull);
|
|
|
|
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD Destroy();
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual nsIWidget* GetParent(void);
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD Show(PRBool bState);
|
|
|
|
NS_IMETHOD IsVisible(PRBool & aState);
|
2000-08-30 21:21:39 +00:00
|
|
|
NS_IMETHOD PlaceBehind(nsIWidget *aWidget, PRBool aActivate);
|
2000-12-14 22:37:08 +00:00
|
|
|
NS_IMETHOD SetSizeMode(PRInt32 aMode);
|
1999-11-12 23:46:11 +00:00
|
|
|
|
|
|
|
NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent,
|
|
|
|
PRBool *aForWindow);
|
1999-05-27 21:09:49 +00:00
|
|
|
|
1999-06-21 20:37:50 +00:00
|
|
|
NS_IMETHOD CaptureMouse(PRBool aCapture);
|
2000-08-04 14:48:33 +00:00
|
|
|
NS_IMETHOD ConstrainPosition(PRInt32 *aX, PRInt32 *aY);
|
1999-07-27 23:26:36 +00:00
|
|
|
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
|
|
|
NS_IMETHOD Resize(PRInt32 aWidth,
|
|
|
|
PRInt32 aHeight,
|
1998-06-01 20:26:50 +00:00
|
|
|
PRBool aRepaint);
|
1999-07-27 23:26:36 +00:00
|
|
|
NS_IMETHOD Resize(PRInt32 aX,
|
|
|
|
PRInt32 aY,
|
|
|
|
PRInt32 aWidth,
|
|
|
|
PRInt32 aHeight,
|
1998-06-01 20:26:50 +00:00
|
|
|
PRBool aRepaint);
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD Enable(PRBool bState);
|
2001-03-19 17:56:04 +00:00
|
|
|
NS_IMETHOD SetFocus(PRBool aRaise);
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD GetBounds(nsRect &aRect);
|
1998-11-04 21:43:47 +00:00
|
|
|
NS_IMETHOD GetClientBounds(nsRect &aRect);
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual nsIFontMetrics* GetFont(void);
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD SetFont(const nsFont &aFont);
|
|
|
|
NS_IMETHOD SetCursor(nsCursor aCursor);
|
2001-05-01 22:50:16 +00:00
|
|
|
NS_IMETHOD Validate();
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
|
1998-10-09 15:18:54 +00:00
|
|
|
NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous);
|
1999-11-20 22:33:42 +00:00
|
|
|
NS_IMETHOD InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSynchronous);
|
1998-10-27 00:16:59 +00:00
|
|
|
NS_IMETHOD Update();
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual void* GetNativeData(PRUint32 aDataType);
|
1999-05-27 23:20:09 +00:00
|
|
|
virtual void FreeNativeData(void * data, PRUint32 aDataType);//~~~
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
|
2000-01-15 01:38:50 +00:00
|
|
|
//XXX-Scroll is obsolete it is going away soon
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
|
2000-01-15 01:38:50 +00:00
|
|
|
NS_IMETHOD ScrollWidgets(PRInt32 aDx, PRInt32 aDy);
|
|
|
|
NS_IMETHOD ScrollRect(nsRect &aRect, PRInt32 aDx, PRInt32 aDy);
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD SetTitle(const nsString& aTitle);
|
2001-04-14 00:57:30 +00:00
|
|
|
NS_IMETHOD SetIcon(const nsAReadableString& aIconSpec);
|
2000-01-31 22:53:35 +00:00
|
|
|
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar) { return NS_ERROR_FAILURE; }
|
|
|
|
NS_IMETHOD ShowMenuBar(PRBool aShow) { return NS_ERROR_FAILURE; }
|
1998-09-28 22:32:48 +00:00
|
|
|
NS_IMETHOD WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect);
|
|
|
|
NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect);
|
|
|
|
NS_IMETHOD BeginResizingChildren(void);
|
|
|
|
NS_IMETHOD EndResizingChildren(void);
|
|
|
|
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
|
|
|
|
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
|
1998-10-07 22:11:37 +00:00
|
|
|
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
1999-08-26 14:41:17 +00:00
|
|
|
NS_IMETHOD EnableDragDrop(PRBool aEnable);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-08-03 22:28:00 +00:00
|
|
|
virtual void SetUpForPaint(HDC aHDC);
|
1998-09-23 19:19:23 +00:00
|
|
|
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
|
1998-09-16 17:18:56 +00:00
|
|
|
|
1999-09-30 14:36:17 +00:00
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);
|
1998-08-03 22:28:00 +00:00
|
|
|
|
1999-12-17 06:11:45 +00:00
|
|
|
NS_IMETHOD GetAttention();
|
1999-12-10 07:20:51 +00:00
|
|
|
|
1999-11-15 20:57:41 +00:00
|
|
|
// nsIKBStateControl interface
|
|
|
|
|
|
|
|
NS_IMETHOD ResetInputState();
|
|
|
|
|
1999-11-12 23:46:11 +00:00
|
|
|
HWND mBorderlessParent;
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
// nsSwitchToUIThread interface
|
|
|
|
virtual BOOL CallMethod(MethodInfo *info);
|
|
|
|
|
|
|
|
HWND GetWindowHandle() { return mWnd; }
|
|
|
|
WNDPROC GetPrevWindowProc() { return mPrevWndProc; }
|
|
|
|
|
1998-05-29 22:44:13 +00:00
|
|
|
virtual PRBool DispatchMouseEvent(PRUint32 aEventType, nsPoint* aPoint = nsnull);
|
2001-08-17 03:13:07 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-04-01 01:38:35 +00:00
|
|
|
virtual PRBool DispatchAccessibleEvent(PRUint32 aEventType, nsIAccessible** aAccessible, nsPoint* aPoint = nsnull);
|
2001-09-25 08:34:42 +00:00
|
|
|
void CreateRootAccessible();
|
2001-08-17 03:13:07 +00:00
|
|
|
#endif
|
1998-04-28 19:24:52 +00:00
|
|
|
virtual PRBool AutoErase();
|
1998-05-29 22:44:13 +00:00
|
|
|
nsPoint* GetLastPoint() { return &mLastPoint; }
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-02-17 14:30:47 +00:00
|
|
|
PRInt32 GetNewCmdMenuId() { mMenuCmdId++; return mMenuCmdId;}
|
|
|
|
|
1999-03-09 23:48:58 +00:00
|
|
|
void InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint = nsnull);
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
protected:
|
2001-05-25 10:53:32 +00:00
|
|
|
// special callback hook methods for pop ups
|
|
|
|
static LRESULT CALLBACK MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM lParam);
|
|
|
|
static LRESULT CALLBACK MozSpecialWndProc(int code, WPARAM wParam, LPARAM lParam);
|
|
|
|
static LRESULT CALLBACK MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam);
|
2001-06-14 02:08:39 +00:00
|
|
|
static VOID CALLBACK HookTimerForPopups( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime );
|
|
|
|
static void ScheduleHookTimer(HWND aWnd, UINT aMsgId);
|
2001-05-25 10:53:32 +00:00
|
|
|
|
|
|
|
static void RegisterSpecialDropdownHooks();
|
|
|
|
static void UnregisterSpecialDropdownHooks();
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2001-03-14 02:34:46 +00:00
|
|
|
static BOOL DealWithPopups ( UINT inMsg, WPARAM inWParam, LPARAM inLParam, LRESULT* outResult ) ;
|
2000-04-13 20:15:40 +00:00
|
|
|
|
2001-03-14 02:34:46 +00:00
|
|
|
static PRBool EventIsInsideWindow(UINT Msg, nsWindow* aWindow);
|
2000-04-27 00:23:18 +00:00
|
|
|
|
|
|
|
static nsWindow * GetNSWindowPtr(HWND aWnd);
|
|
|
|
static BOOL SetNSWindowPtr(HWND aWnd, nsWindow * ptr);
|
|
|
|
|
1999-03-05 15:34:53 +00:00
|
|
|
virtual PRBool ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *aRetValue);
|
|
|
|
virtual PRBool DispatchWindowEvent(nsGUIEvent* event);
|
1999-11-12 02:06:52 +00:00
|
|
|
virtual PRBool DispatchWindowEvent(nsGUIEvent*event, nsEventStatus &aStatus);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-05-14 21:34:08 +00:00
|
|
|
// Allow Derived classes to modify the height that is passed
|
|
|
|
// when the window is created or resized.
|
|
|
|
virtual PRInt32 GetHeight(PRInt32 aProposedHeight);
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual LPCTSTR WindowClass();
|
|
|
|
virtual DWORD WindowStyle();
|
|
|
|
virtual DWORD WindowExStyle();
|
|
|
|
|
1998-08-03 22:28:00 +00:00
|
|
|
virtual void SubclassWindow(BOOL bState);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
virtual void OnDestroy();
|
1998-05-29 22:44:13 +00:00
|
|
|
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual PRBool OnPaint();
|
|
|
|
virtual PRBool OnResize(nsRect &aWindowRect);
|
1999-04-23 14:30:51 +00:00
|
|
|
|
1999-06-11 20:32:09 +00:00
|
|
|
BOOL OnChar(UINT mbcsCharCode, UINT virtualKeyCode, bool isMultibyte);
|
1999-06-04 05:14:01 +00:00
|
|
|
|
1999-04-23 14:30:51 +00:00
|
|
|
BOOL OnKeyDown( UINT aVirtualKeyCode, UINT aScanCode);
|
|
|
|
BOOL OnKeyUp( UINT aVirtualKeyCode, UINT aScanCode);
|
2000-02-02 15:00:59 +00:00
|
|
|
UINT MapFromNativeToDOM(UINT aNativeKeyCode);
|
1999-11-11 22:28:52 +00:00
|
|
|
|
|
|
|
|
1999-12-01 22:10:13 +00:00
|
|
|
BOOL OnInputLangChange(HKL aHKL, LRESULT *oResult);
|
1999-11-11 22:28:52 +00:00
|
|
|
BOOL OnIMEChar(BYTE aByte1, BYTE aByte2, LPARAM aKeyState);
|
|
|
|
BOOL OnIMEComposition(LPARAM aGCS);
|
|
|
|
BOOL OnIMECompositionFull();
|
|
|
|
BOOL OnIMEEndComposition();
|
|
|
|
BOOL OnIMENotify(WPARAM aIMN, LPARAM aData, LRESULT *oResult);
|
2000-08-04 21:43:29 +00:00
|
|
|
BOOL OnIMERequest(WPARAM aIMR, LPARAM aData, LRESULT *oResult, PRBool aUseUnicode = PR_FALSE);
|
1999-11-11 22:28:52 +00:00
|
|
|
BOOL OnIMESelect(BOOL aSelected, WORD aLangID);
|
1999-11-15 20:57:41 +00:00
|
|
|
BOOL OnIMESetContext(BOOL aActive, LPARAM& aISC);
|
1999-11-11 22:28:52 +00:00
|
|
|
BOOL OnIMEStartComposition();
|
2000-08-04 21:43:29 +00:00
|
|
|
BOOL OnIMEReconvert(LPARAM aData, LRESULT *oResult, PRBool aUseUnicode);
|
1999-11-11 22:28:52 +00:00
|
|
|
|
1999-04-23 14:30:51 +00:00
|
|
|
ULONG IsSpecialChar(UINT aVirtualKeyCode, WORD *aAsciiKey);
|
|
|
|
virtual PRBool DispatchKeyEvent(PRUint32 aEventType, WORD aCharCode, UINT aVirtualCharCode);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2001-05-18 12:07:42 +00:00
|
|
|
virtual PRBool DispatchFocus(PRUint32 aEventType, PRBool isMozWindowTakingFocus);
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual PRBool OnScroll(UINT scrollCode, int cPos);
|
|
|
|
virtual HBRUSH OnControlColor();
|
|
|
|
|
|
|
|
static LRESULT CALLBACK WindowProc(HWND hWnd,
|
|
|
|
UINT msg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam);
|
2000-01-07 00:34:34 +00:00
|
|
|
#ifdef MOZ_AIMM
|
|
|
|
static LRESULT CALLBACK DefaultWindowProc(HWND hWns, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
|
|
#endif
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
static PRBool ConvertStatus(nsEventStatus aStatus);
|
|
|
|
|
1998-05-04 19:25:25 +00:00
|
|
|
PRBool DispatchStandardEvent(PRUint32 aMsg);
|
|
|
|
void RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam);
|
1998-04-24 23:09:11 +00:00
|
|
|
|
1998-06-16 17:16:59 +00:00
|
|
|
void GetNonClientBounds(nsRect &aRect);
|
2000-02-02 15:00:59 +00:00
|
|
|
void HandleTextEvent(HIMC hIMEContext, PRBool aCheckAttr=PR_TRUE);
|
|
|
|
void HandleStartComposition(HIMC hIMEContext);
|
|
|
|
void HandleEndComposition(void);
|
|
|
|
void MapDBCSAtrributeArrayToUnicodeOffsets(PRUint32* textRangeListLengthResult, nsTextRangeArray* textRangeListResult);
|
1998-06-16 17:16:59 +00:00
|
|
|
|
2000-04-01 22:16:43 +00:00
|
|
|
void ConstrainZLevel(HWND *aAfter);
|
|
|
|
|
1999-07-09 12:23:24 +00:00
|
|
|
private:
|
|
|
|
|
2001-05-17 23:52:32 +00:00
|
|
|
|
1999-07-09 12:23:24 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
void DebugPrintEvent(nsGUIEvent & aEvent,
|
1999-07-09 13:11:13 +00:00
|
|
|
HWND aWnd);
|
1999-07-09 12:23:24 +00:00
|
|
|
#endif
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
protected:
|
2000-05-11 22:59:20 +00:00
|
|
|
nsSize mLastSize;
|
1998-05-29 22:44:13 +00:00
|
|
|
static nsWindow* gCurrentWindow;
|
1999-10-02 00:13:23 +00:00
|
|
|
PRBool mIsTopWidgetWindow;
|
1998-05-29 22:44:13 +00:00
|
|
|
nsPoint mLastPoint;
|
1998-04-13 20:24:54 +00:00
|
|
|
HWND mWnd;
|
2001-08-09 20:22:39 +00:00
|
|
|
#if 0
|
1998-04-13 20:24:54 +00:00
|
|
|
HPALETTE mPalette;
|
2001-08-09 20:22:39 +00:00
|
|
|
#endif
|
1998-04-13 20:24:54 +00:00
|
|
|
WNDPROC mPrevWndProc;
|
1999-06-08 06:07:51 +00:00
|
|
|
|
1998-11-04 21:43:47 +00:00
|
|
|
PRBool mHas3DBorder;
|
1998-04-13 20:24:54 +00:00
|
|
|
HBRUSH mBrush;
|
|
|
|
PRBool mIsShiftDown;
|
|
|
|
PRBool mIsControlDown;
|
|
|
|
PRBool mIsAltDown;
|
1998-04-28 18:59:38 +00:00
|
|
|
PRBool mIsDestroying;
|
1998-09-15 03:45:06 +00:00
|
|
|
PRBool mOnDestroyCalled;
|
1998-09-28 22:32:48 +00:00
|
|
|
PRBool mIsVisible;
|
|
|
|
// XXX Temporary, should not be caching the font
|
|
|
|
nsFont * mFont;
|
|
|
|
|
|
|
|
PRInt32 mPreferredWidth;
|
|
|
|
PRInt32 mPreferredHeight;
|
|
|
|
|
1999-03-05 15:34:53 +00:00
|
|
|
PRInt32 mMenuCmdId;
|
1999-02-17 14:30:47 +00:00
|
|
|
|
1999-03-19 23:36:20 +00:00
|
|
|
// For Input Method Support
|
|
|
|
DWORD mIMEProperty;
|
|
|
|
PRBool mIMEIsComposing;
|
2000-10-11 21:50:50 +00:00
|
|
|
PRBool mIMEIsStatusChanged;
|
1999-11-16 23:45:44 +00:00
|
|
|
nsCString* mIMECompString;
|
|
|
|
nsString* mIMECompUnicode;
|
1999-11-30 22:09:28 +00:00
|
|
|
PRUint8* mIMEAttributeString;
|
1999-06-29 20:31:22 +00:00
|
|
|
PRInt32 mIMEAttributeStringLength;
|
|
|
|
PRInt32 mIMEAttributeStringSize;
|
1999-11-30 22:09:28 +00:00
|
|
|
PRUint32* mIMECompClauseString;
|
1999-06-29 20:31:22 +00:00
|
|
|
PRInt32 mIMECompClauseStringLength;
|
|
|
|
PRInt32 mIMECompClauseStringSize;
|
1999-07-14 20:08:02 +00:00
|
|
|
long mIMECursorPosition;
|
1999-12-01 22:10:13 +00:00
|
|
|
|
2000-08-04 21:43:29 +00:00
|
|
|
PRUnichar* mIMEReconvertUnicode; // reconvert string
|
|
|
|
|
1999-12-01 22:10:13 +00:00
|
|
|
static UINT gCurrentKeyboardCP;
|
|
|
|
static HKL gKeyboardLayout;
|
1999-06-29 20:31:22 +00:00
|
|
|
|
1999-08-05 14:56:21 +00:00
|
|
|
PRBool mIsInMouseCapture;
|
|
|
|
|
1999-03-19 23:36:20 +00:00
|
|
|
|
1999-03-09 23:48:58 +00:00
|
|
|
// Drag & Drop
|
1999-04-06 20:23:55 +00:00
|
|
|
nsNativeDragTarget * mNativeDragTarget;
|
1999-06-17 23:23:11 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
// Enumeration of the methods which are accessable on the "main GUI thread"
|
|
|
|
// via the CallMethod(...) mechanism...
|
|
|
|
// see nsSwitchToUIThread
|
|
|
|
enum {
|
|
|
|
CREATE = 0x0101,
|
|
|
|
CREATE_NATIVE,
|
|
|
|
DESTROY,
|
|
|
|
SET_FOCUS,
|
|
|
|
SET_CURSOR,
|
|
|
|
CREATE_HACK
|
|
|
|
};
|
|
|
|
|
|
|
|
static BOOL sIsRegistered;
|
1998-05-13 03:39:08 +00:00
|
|
|
|
|
|
|
HDWP mDeferredPositioner;
|
2000-03-18 00:57:23 +00:00
|
|
|
static UINT uMSH_MOUSEWHEEL;
|
2000-08-04 21:43:29 +00:00
|
|
|
|
|
|
|
// IME special message
|
|
|
|
static UINT uWM_MSIME_RECONVERT; // reconvert messge for MSIME
|
|
|
|
static UINT uWM_MSIME_MOUSE; // mouse messge for MSIME
|
|
|
|
static UINT uWM_ATOK_RECONVERT; // reconvert messge for ATOK
|
2001-04-17 23:06:38 +00:00
|
|
|
|
2001-08-17 03:13:07 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-04-17 23:06:38 +00:00
|
|
|
IAccessible* mRootAccessible;
|
2001-09-25 08:34:42 +00:00
|
|
|
static BOOL gIsAccessibilityOn;
|
2001-08-17 03:13:07 +00:00
|
|
|
#endif
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// A child window is a window with different style
|
|
|
|
//
|
|
|
|
class ChildWindow : public nsWindow {
|
|
|
|
|
|
|
|
public:
|
1998-09-14 20:40:49 +00:00
|
|
|
ChildWindow(){}
|
1998-07-21 18:04:18 +00:00
|
|
|
PRBool DispatchMouseEvent(PRUint32 aEventType, nsPoint* aPoint = nsnull);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual DWORD WindowStyle();
|
|
|
|
};
|
|
|
|
|
1998-04-17 23:45:07 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
#endif // Window_h__
|