mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
Bug 522896 - OS/2 Code Maintenance; cm01 thru cm10 - combined patch - v3.
r=(Weilbacher, wuno).
This commit is contained in:
parent
fa2e9b9d14
commit
d0e0a35a1a
@ -38,7 +38,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAppShell.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
static UINT sMsgId;
|
||||
|
@ -38,7 +38,6 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsClipboard.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -47,10 +46,8 @@
|
||||
#include "prmem.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsOS2Uni.h"
|
||||
|
||||
#include <unidef.h> // for UniStrlen
|
||||
#include "nsClipboard.h"
|
||||
|
||||
inline ULONG RegisterClipboardFormat(PCSZ pcszFormat)
|
||||
{
|
||||
|
@ -38,14 +38,14 @@
|
||||
#ifndef _nsClipboard_h
|
||||
#define _nsClipboard_h
|
||||
|
||||
#include "nsWidgetDefs.h"
|
||||
#include "nsBaseClipboard.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
#define INCL_DOSERRORS
|
||||
#define INCL_WIN
|
||||
#include <os2.h>
|
||||
|
||||
class nsITransferable;
|
||||
class nsIClipboardOwner;
|
||||
class nsIWidget;
|
||||
struct IDataObject;
|
||||
|
||||
/**
|
||||
* Native OS/2 Clipboard wrapper
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsOS2Uni.h"
|
||||
#include "nsdefs.h"
|
||||
#include "wdgtos2rc.h"
|
||||
#include "nsILocalFileOS2.h"
|
||||
#include "nsIDocument.h"
|
||||
@ -76,6 +75,13 @@
|
||||
#define OS2FILE_TXTRMF "<DRM_OS2FILE, DRF_TEXT>"
|
||||
#define OS2FILE_UNKRMF "<DRM_OS2FILE, DRF_UNKNOWN>"
|
||||
|
||||
// not defined in the OS/2 toolkit headers
|
||||
extern "C" {
|
||||
APIRET APIENTRY DosQueryModFromEIP(HMODULE *phMod, ULONG *pObjNum,
|
||||
ULONG BuffLen, PCHAR pBuff,
|
||||
ULONG *pOffset, ULONG Address);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Helper functions
|
||||
|
||||
|
@ -37,25 +37,23 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Define so header files for openfilename are included
|
||||
#ifdef WIN32_LEAN_AND_MEAN
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsWidgetDefs.h"
|
||||
#include "nsFilePicker.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsOS2Uni.h"
|
||||
#include "nsFilePicker.h"
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH CCHMAXPATH
|
||||
#endif
|
||||
|
||||
/* Item structure */
|
||||
typedef struct _MyData
|
||||
|
@ -43,14 +43,18 @@
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsBaseFilePicker.h"
|
||||
#include "nsString.h"
|
||||
#include "nsdefs.h"
|
||||
|
||||
#define INCL_DOS
|
||||
#define INCL_NLS
|
||||
#define INCL_WIN
|
||||
#define INCL_WINSTDFILE
|
||||
#include <os2.h>
|
||||
|
||||
/**
|
||||
* Native Windows FileSelector wrapper
|
||||
* Native OS/2 FileSelector wrapper
|
||||
*/
|
||||
|
||||
class nsFilePicker : public nsBaseFilePicker
|
||||
|
@ -1,4 +1,7 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
/* vim: set sw=2 sts=2 et cin: */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
@ -36,299 +39,257 @@
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*
|
||||
* This Original Code has been modified by IBM Corporation.
|
||||
* Modifications made by IBM described herein are
|
||||
* Copyright (c) International Business Machines
|
||||
* Corporation, 2000
|
||||
* Modifications made by IBM are
|
||||
* Copyright (c) International Business Machines Corporation, 2000
|
||||
*
|
||||
* Modifications to Mozilla code or documentation
|
||||
* identified per MPL Section 3.3
|
||||
*
|
||||
* Date Modified by Description of modification
|
||||
* 03/23/2000 IBM Corp. Fix missing title bars on profile wizard windows.
|
||||
* 04/11/2000 IBM Corp. Remove assertion.
|
||||
* 05/10/2000 IBM Corp. Correct initial position of frame w/titlebar
|
||||
* 06/21/2000 IBM Corp. Use rollup listener from nsWindow
|
||||
*/
|
||||
|
||||
// Frame window - produced when NS_WINDOW_CID is required.
|
||||
//=============================================================================
|
||||
|
||||
#include "nsFrameWindow.h"
|
||||
#include "nsIRollupListener.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsGfxCIID.h"
|
||||
|
||||
extern nsIRollupListener * gRollupListener;
|
||||
extern nsIWidget * gRollupWidget;
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern nsIRollupListener* gRollupListener;
|
||||
extern nsIWidget* gRollupWidget;
|
||||
extern PRBool gRollupConsumeRollupEvent;
|
||||
extern PRUint32 gOS2Flags;
|
||||
|
||||
#ifdef DEBUG_FOCUS
|
||||
extern int currentWindowIdentifier;
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
// nsFrameWindow Setup
|
||||
//=============================================================================
|
||||
|
||||
nsFrameWindow::nsFrameWindow() : nsWindow()
|
||||
{
|
||||
fnwpDefFrame = 0;
|
||||
mWindowType = eWindowType_toplevel;
|
||||
mNeedActivation = PR_FALSE;
|
||||
mPrevFrameProc = 0;
|
||||
mWindowType = eWindowType_toplevel;
|
||||
mNeedActivation = PR_FALSE;
|
||||
}
|
||||
|
||||
nsFrameWindow::~nsFrameWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void nsFrameWindow::SetWindowListVisibility( PRBool bState)
|
||||
{
|
||||
HSWITCH hswitch;
|
||||
SWCNTRL swctl;
|
||||
//-----------------------------------------------------------------------------
|
||||
// Create frame & client windows for an nsFrameWindow object
|
||||
|
||||
hswitch = WinQuerySwitchHandle(mFrameWnd, 0);
|
||||
if( hswitch)
|
||||
{
|
||||
WinQuerySwitchEntry( hswitch, &swctl);
|
||||
swctl.uchVisibility = bState ? SWL_VISIBLE : SWL_INVISIBLE;
|
||||
swctl.fbJump = bState ? SWL_JUMPABLE : SWL_NOTJUMPABLE;
|
||||
WinChangeSwitchEntry( hswitch, &swctl);
|
||||
}
|
||||
nsresult nsFrameWindow::CreateWindow(nsWindow* aParent,
|
||||
HWND aParentWnd,
|
||||
const nsIntRect& aRect,
|
||||
PRUint32 aStyle)
|
||||
{
|
||||
// top-level widget windows (i.e nsFrameWindow) are created for
|
||||
// windows of types eWindowType_toplevel, *_dialog, & *_invisible
|
||||
mIsTopWidgetWindow = PR_TRUE;
|
||||
|
||||
// Create a frame window with a MozillaWindowClass window as its client.
|
||||
PRUint32 fcfFlags = GetFCFlags();
|
||||
mFrameWnd = WinCreateStdWindow(HWND_DESKTOP,
|
||||
0,
|
||||
(ULONG*)&fcfFlags,
|
||||
kWindowClassName,
|
||||
"Title",
|
||||
aStyle,
|
||||
NULLHANDLE,
|
||||
0,
|
||||
&mWnd);
|
||||
NS_ENSURE_TRUE(mFrameWnd, NS_ERROR_FAILURE);
|
||||
|
||||
// Hide from the Window List until shown.
|
||||
SetWindowListVisibility(PR_FALSE);
|
||||
|
||||
// This prevents a modal dialog from being covered by its disabled parent.
|
||||
if (aParentWnd != HWND_DESKTOP) {
|
||||
WinSetOwner(mFrameWnd, aParentWnd);
|
||||
}
|
||||
|
||||
// Set the frame control HWNDs as properties for use by fullscreen mode.
|
||||
HWND hTemp = WinWindowFromID(mFrameWnd, FID_TITLEBAR);
|
||||
WinSetProperty(mFrameWnd, "hwndTitleBar", (PVOID)hTemp, 0);
|
||||
hTemp = WinWindowFromID(mFrameWnd, FID_SYSMENU);
|
||||
WinSetProperty(mFrameWnd, "hwndSysMenu", (PVOID)hTemp, 0);
|
||||
hTemp = WinWindowFromID(mFrameWnd, FID_MINMAX);
|
||||
WinSetProperty(mFrameWnd, "hwndMinMax", (PVOID)hTemp, 0);
|
||||
|
||||
// Establish a minimum height or else some dialogs will be truncated.
|
||||
PRInt32 minHeight;
|
||||
if (fcfFlags & FCF_SIZEBORDER) {
|
||||
minHeight = 2 * WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
|
||||
} else if (fcfFlags & FCF_DLGBORDER) {
|
||||
minHeight = 2 * WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME);
|
||||
} else {
|
||||
minHeight = 2 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);
|
||||
}
|
||||
if (fcfFlags & FCF_TITLEBAR) {
|
||||
minHeight += WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
|
||||
}
|
||||
|
||||
// Store the frame's adjusted dimensions, move & resize accordingly,
|
||||
// then calculate the client's dimensions.
|
||||
mBounds = aRect;
|
||||
if (mBounds.height < minHeight) {
|
||||
mBounds.height = minHeight;
|
||||
}
|
||||
PRInt32 pmY = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN)
|
||||
- mBounds.y - mBounds.height;
|
||||
WinSetWindowPos(mFrameWnd, 0, mBounds.x, pmY,
|
||||
mBounds.width, mBounds.height, SWP_SIZE | SWP_MOVE);
|
||||
UpdateClientSize();
|
||||
|
||||
// Subclass the frame; the client will be subclassed by Create().
|
||||
mPrevFrameProc = WinSubclassWindow(mFrameWnd, fnwpFrame);
|
||||
WinSetWindowPtr(mFrameWnd, QWL_USER, this);
|
||||
|
||||
DEBUGFOCUS(Create nsFrameWindow);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Called in the PM thread.
|
||||
void nsFrameWindow::RealDoCreate( HWND hwndP, nsWindow *aParent,
|
||||
const nsIntRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsWidgetInitData *aInitData, HWND hwndO)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
PRUint32 nsFrameWindow::GetFCFlags()
|
||||
{
|
||||
nsIntRect rect = aRect;
|
||||
if( aParent) // Offset rect by position of owner
|
||||
{
|
||||
nsIntRect clientRect;
|
||||
aParent->GetBounds(rect);
|
||||
aParent->GetClientBounds(clientRect);
|
||||
rect.x += aRect.x + clientRect.x;
|
||||
rect.y += aRect.y + clientRect.y;
|
||||
rect.width = aRect.width;
|
||||
rect.height = aRect.height;
|
||||
hwndP = aParent->GetMainWindow();
|
||||
rect.y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - (rect.y + rect.height);
|
||||
}
|
||||
else // Use original rect, no owner window
|
||||
{
|
||||
rect = aRect;
|
||||
rect.y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - (aRect.y + aRect.height);
|
||||
}
|
||||
PRUint32 style = FCF_TITLEBAR | FCF_SYSMENU | FCF_TASKLIST |
|
||||
FCF_CLOSEBUTTON | FCF_NOBYTEALIGN | FCF_AUTOICON;
|
||||
|
||||
#if DEBUG_sobotka
|
||||
printf("\nIn nsFrameWindow::RealDoCreate:\n");
|
||||
printf(" hwndP = %lu\n", hwndP);
|
||||
printf(" aParent = 0x%lx\n", &aParent);
|
||||
printf(" aRect = %ld, %ld, %ld, %ld\n", aRect.x, aRect.y, aRect.height, aRect.width);
|
||||
#endif
|
||||
if (mWindowType == eWindowType_dialog) {
|
||||
if (mBorderStyle == eBorderStyle_default) {
|
||||
style |= FCF_DLGBORDER;
|
||||
} else {
|
||||
style |= FCF_SIZEBORDER | FCF_MINMAX;
|
||||
}
|
||||
}
|
||||
else {
|
||||
style |= FCF_SIZEBORDER | FCF_MINMAX;
|
||||
}
|
||||
|
||||
ULONG fcfFlags = GetFCFlags();
|
||||
if (gOS2Flags & kIsDBCS) {
|
||||
style |= FCF_DBE_APPSTAT;
|
||||
}
|
||||
if (mWindowType == eWindowType_invisible) {
|
||||
style &= ~FCF_TASKLIST;
|
||||
}
|
||||
|
||||
ULONG style = WindowStyle();
|
||||
if( aInitData)
|
||||
{
|
||||
if( aInitData->clipChildren)
|
||||
style |= WS_CLIPCHILDREN;
|
||||
#if 0
|
||||
//
|
||||
// Windows has a slightly different idea of what the implications are
|
||||
// of a window having or not having the CLIPSIBLINGS style.
|
||||
// All 'canvas' components we create must have clipsiblings, or
|
||||
// strange things happen & performance actually degrades.
|
||||
//
|
||||
else
|
||||
style &= ~WS_CLIPCHILDREN;
|
||||
#endif
|
||||
if (mBorderStyle != eBorderStyle_default &&
|
||||
mBorderStyle != eBorderStyle_all) {
|
||||
if (mBorderStyle == eBorderStyle_none ||
|
||||
!(mBorderStyle & eBorderStyle_resizeh)) {
|
||||
style &= ~FCF_SIZEBORDER;
|
||||
style |= FCF_DLGBORDER;
|
||||
}
|
||||
if (mBorderStyle == eBorderStyle_none ||
|
||||
!(mBorderStyle & eBorderStyle_border)) {
|
||||
style &= ~(FCF_DLGBORDER | FCF_SIZEBORDER);
|
||||
}
|
||||
if (mBorderStyle == eBorderStyle_none ||
|
||||
!(mBorderStyle & eBorderStyle_title)) {
|
||||
style &= ~(FCF_TITLEBAR | FCF_TASKLIST);
|
||||
}
|
||||
if (mBorderStyle == eBorderStyle_none ||
|
||||
!(mBorderStyle & eBorderStyle_close)) {
|
||||
style &= ~FCF_CLOSEBUTTON;
|
||||
}
|
||||
if (mBorderStyle == eBorderStyle_none ||
|
||||
!(mBorderStyle & (eBorderStyle_menu | eBorderStyle_close))) {
|
||||
style &= ~FCF_SYSMENU;
|
||||
}
|
||||
|
||||
if( aInitData->clipSiblings)
|
||||
style |= WS_CLIPSIBLINGS;
|
||||
else
|
||||
style &= ~WS_CLIPSIBLINGS;
|
||||
}
|
||||
// Looks like getting rid of the system menu also does away
|
||||
// with the close box. So, we only get rid of the system menu
|
||||
// if you want neither it nor the close box.
|
||||
|
||||
#ifdef DEBUG_FOCUS
|
||||
mWindowIdentifier = currentWindowIdentifier;
|
||||
currentWindowIdentifier++;
|
||||
if (aInitData && (aInitData->mWindowType == eWindowType_toplevel))
|
||||
DEBUGFOCUS(Create Frame Window);
|
||||
else
|
||||
DEBUGFOCUS(Create Window);
|
||||
#endif
|
||||
if (mBorderStyle == eBorderStyle_none ||
|
||||
!(mBorderStyle & eBorderStyle_minimize)) {
|
||||
style &= ~FCF_MINBUTTON;
|
||||
}
|
||||
if (mBorderStyle == eBorderStyle_none ||
|
||||
!(mBorderStyle & eBorderStyle_maximize)) {
|
||||
style &= ~FCF_MAXBUTTON;
|
||||
}
|
||||
}
|
||||
|
||||
mFrameWnd = WinCreateStdWindow( HWND_DESKTOP,
|
||||
0,
|
||||
&fcfFlags,
|
||||
WindowClass(),
|
||||
"Title",
|
||||
style,
|
||||
NULLHANDLE,
|
||||
0,
|
||||
&mWnd);
|
||||
|
||||
|
||||
/* Because WinCreateStdWindow doesn't take an owner, we have to set it */
|
||||
if (hwndP)
|
||||
WinSetOwner(mFrameWnd, hwndP);
|
||||
|
||||
|
||||
/* Set some HWNDs and style into properties for fullscreen mode */
|
||||
HWND hwndTitleBar = WinWindowFromID(mFrameWnd, FID_TITLEBAR);
|
||||
WinSetProperty(mFrameWnd, "hwndTitleBar", (PVOID)hwndTitleBar, 0);
|
||||
HWND hwndSysMenu = WinWindowFromID(mFrameWnd, FID_SYSMENU);
|
||||
WinSetProperty(mFrameWnd, "hwndSysMenu", (PVOID)hwndSysMenu, 0);
|
||||
HWND hwndMinMax = WinWindowFromID(mFrameWnd, FID_MINMAX);
|
||||
WinSetProperty(mFrameWnd, "hwndMinMax", (PVOID)hwndMinMax, 0);
|
||||
|
||||
|
||||
SetWindowListVisibility( PR_FALSE); // Hide from Window List until shown
|
||||
|
||||
NS_ASSERTION( mFrameWnd, "Couldn't create frame");
|
||||
|
||||
// Frames have a minimum height based on the pieces they are created with,
|
||||
// such as titlebar, menubar, frame borders, etc. We need this minimum
|
||||
// height so we can correctly set the frame position (coordinate flipping).
|
||||
nsIntRect frameRect = rect;
|
||||
long minheight;
|
||||
|
||||
if ( fcfFlags & FCF_SIZEBORDER) {
|
||||
minheight = 2 * WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER);
|
||||
}
|
||||
else if ( fcfFlags & FCF_DLGBORDER) {
|
||||
minheight = 2 * WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME);
|
||||
}
|
||||
else {
|
||||
minheight = 2 * WinQuerySysValue( HWND_DESKTOP, SV_CYBORDER);
|
||||
}
|
||||
if ( fcfFlags & FCF_TITLEBAR) {
|
||||
minheight += WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR);
|
||||
}
|
||||
if ( frameRect.height < minheight) {
|
||||
frameRect.height = minheight;
|
||||
}
|
||||
|
||||
// Set up parent data - don't addref to avoid circularity
|
||||
mParent = nsnull;
|
||||
|
||||
// Make sure we have a device context from somewhere
|
||||
if( aContext)
|
||||
{
|
||||
mContext = aContext;
|
||||
NS_ADDREF(mContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
nsresult rc;
|
||||
static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
|
||||
|
||||
rc = CallCreateInstance(kDeviceContextCID, &mContext);
|
||||
if( NS_SUCCEEDED(rc))
|
||||
mContext->Init(this);
|
||||
#ifdef DEBUG
|
||||
else
|
||||
printf( "Couldn't find DC instance for nsWindow\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Record bounds. This is XP, the rect of the entire main window in
|
||||
// parent space. Returned by GetBounds().
|
||||
// NB: We haven't subclassed yet, so callbacks to change mBounds won't
|
||||
// have happened!
|
||||
mBounds = frameRect;
|
||||
mBounds.height = frameRect.height;
|
||||
|
||||
// Record passed in things
|
||||
mEventCallback = aHandleEventFunction;
|
||||
|
||||
if( mParent)
|
||||
mParent->AddChild( this);
|
||||
|
||||
// call the event callback to notify about creation
|
||||
|
||||
DispatchStandardEvent( NS_CREATE );
|
||||
SubclassWindow(TRUE);
|
||||
PostCreateWidget();
|
||||
|
||||
// Subclass frame
|
||||
fnwpDefFrame = WinSubclassWindow( mFrameWnd, fnwpFrame);
|
||||
WinSetWindowPtr( mFrameWnd, QWL_USER, this);
|
||||
|
||||
|
||||
WinSetWindowPos(mFrameWnd, 0, frameRect.x, frameRect.y, frameRect.width, frameRect.height, SWP_SIZE | SWP_MOVE);
|
||||
return style;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Window Operations
|
||||
//=============================================================================
|
||||
|
||||
// For frame windows, 'Show' is equivalent to 'Show & Activate'
|
||||
|
||||
NS_METHOD nsFrameWindow::Show(PRBool aState)
|
||||
{
|
||||
if (!mWnd) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32 ulFlags;
|
||||
if (!aState) {
|
||||
ulFlags = SWP_HIDE | SWP_DEACTIVATE;
|
||||
} else {
|
||||
ulFlags = SWP_SHOW;
|
||||
|
||||
// Don't activate the window unless the parent is visible
|
||||
if (WinIsWindowVisible(WinQueryWindow(mFrameWnd, QW_PARENT))) {
|
||||
ulFlags |= SWP_ACTIVATE;
|
||||
}
|
||||
|
||||
PRUint32 ulStyle = WinQueryWindowULong(mFrameWnd, QWL_STYLE);
|
||||
if (!(ulStyle & WS_VISIBLE)) {
|
||||
PRInt32 sizeMode;
|
||||
GetSizeMode(&sizeMode);
|
||||
if (sizeMode == nsSizeMode_Maximized) {
|
||||
ulFlags |= SWP_MAXIMIZE;
|
||||
} else if (sizeMode == nsSizeMode_Minimized) {
|
||||
ulFlags |= SWP_MINIMIZE;
|
||||
} else {
|
||||
ulFlags |= SWP_RESTORE;
|
||||
}
|
||||
}
|
||||
if (ulStyle & WS_MINIMIZED) {
|
||||
ulFlags |= (SWP_RESTORE | SWP_MAXIMIZE);
|
||||
}
|
||||
}
|
||||
|
||||
WinSetWindowPos(mFrameWnd, 0, 0, 0, 0, 0, ulFlags);
|
||||
SetWindowListVisibility(aState);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsFrameWindow::GetClientBounds(nsIntRect& aRect)
|
||||
{
|
||||
RECTL rcl = { 0, 0, mBounds.width, mBounds.height };
|
||||
WinCalcFrameRect(mFrameWnd, &rcl, TRUE); // provided == frame rect
|
||||
aRect.x = rcl.xLeft;
|
||||
aRect.y = mBounds.height - rcl.yTop;
|
||||
aRect.width = mSizeClient.width;
|
||||
aRect.height = mSizeClient.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void nsFrameWindow::UpdateClientSize()
|
||||
{
|
||||
RECTL rcl = { 0, 0, mBounds.width, mBounds.height };
|
||||
WinCalcFrameRect( mFrameWnd, &rcl, TRUE); // provided == frame rect
|
||||
mSizeClient.width = rcl.xRight - rcl.xLeft;
|
||||
mSizeClient.height = rcl.yTop - rcl.yBottom;
|
||||
mSizeBorder.width = (mBounds.width - mSizeClient.width) / 2;
|
||||
mSizeBorder.height = (mBounds.height - mSizeClient.height) / 2;
|
||||
}
|
||||
|
||||
nsresult nsFrameWindow::GetClientBounds( nsIntRect &aRect)
|
||||
{
|
||||
RECTL rcl = { 0, 0, mBounds.width, mBounds.height };
|
||||
WinCalcFrameRect( mFrameWnd, &rcl, TRUE); // provided == frame rect
|
||||
aRect.x = rcl.xLeft;
|
||||
aRect.y = mBounds.height - rcl.yTop;
|
||||
aRect.width = mSizeClient.width;
|
||||
aRect.height = mSizeClient.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Just ignore this callback; the correct stuff is done in the frame wp.
|
||||
PRBool nsFrameWindow::OnReposition( PSWP pSwp)
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// For frame windows, 'Show' is equivalent to 'Show & Activate'
|
||||
nsresult nsFrameWindow::Show( PRBool bState)
|
||||
{
|
||||
if( mWnd)
|
||||
{
|
||||
ULONG ulFlags;
|
||||
if( bState) {
|
||||
ULONG ulStyle = WinQueryWindowULong( GetMainWindow(), QWL_STYLE);
|
||||
ulFlags = SWP_SHOW;
|
||||
/* Don't activate the window unless the parent is visible */
|
||||
if (WinIsWindowVisible(WinQueryWindow(GetMainWindow(), QW_PARENT)))
|
||||
ulFlags |= SWP_ACTIVATE;
|
||||
if (!( ulStyle & WS_VISIBLE)) {
|
||||
PRInt32 sizeMode;
|
||||
GetSizeMode( &sizeMode);
|
||||
if ( sizeMode == nsSizeMode_Maximized) {
|
||||
ulFlags |= SWP_MAXIMIZE;
|
||||
} else if ( sizeMode == nsSizeMode_Minimized) {
|
||||
ulFlags |= SWP_MINIMIZE;
|
||||
} else {
|
||||
ulFlags |= SWP_RESTORE;
|
||||
}
|
||||
}
|
||||
if( ulStyle & WS_MINIMIZED)
|
||||
ulFlags |= (SWP_RESTORE | SWP_MAXIMIZE);
|
||||
}
|
||||
else
|
||||
ulFlags = SWP_HIDE | SWP_DEACTIVATE;
|
||||
WinSetWindowPos( GetMainWindow(), NULLHANDLE, 0L, 0L, 0L, 0L, ulFlags);
|
||||
SetWindowListVisibility( bState);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
RECTL rcl = { 0, 0, mBounds.width, mBounds.height };
|
||||
WinCalcFrameRect(mFrameWnd, &rcl, TRUE); // provided == frame rect
|
||||
mSizeClient.width = rcl.xRight - rcl.xLeft;
|
||||
mSizeClient.height = rcl.yTop - rcl.yBottom;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// When WM_ACTIVATE is received with the "gaining activation" flag set,
|
||||
// the frame's wndproc sets mNeedActivation. Later, when an nsWindow
|
||||
// gets a WM_FOCUSCHANGED msg with the "gaining focus" flag set, it
|
||||
// invokes this method on nsFrameWindow to fire an NS_ACTIVATE event.
|
||||
|
||||
void nsFrameWindow::ActivateTopLevelWidget()
|
||||
void nsFrameWindow::ActivateTopLevelWidget()
|
||||
{
|
||||
// Don't fire event if we're minimized or else the window will
|
||||
// be restored as soon as the user clicks on it. When the user
|
||||
@ -340,181 +301,205 @@ void nsFrameWindow::ActivateTopLevelWidget()
|
||||
if (sizeMode != nsSizeMode_Minimized) {
|
||||
mNeedActivation = PR_FALSE;
|
||||
DEBUGFOCUS(NS_ACTIVATE);
|
||||
DispatchFocus(NS_ACTIVATE);
|
||||
DispatchActivationEvent(NS_ACTIVATE);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Just ignore this callback; the correct stuff is done in the frame wp.
|
||||
|
||||
PRBool nsFrameWindow::OnReposition(PSWP pSwp)
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void nsFrameWindow::SetWindowListVisibility(PRBool aState)
|
||||
{
|
||||
HSWITCH hswitch = WinQuerySwitchHandle(mFrameWnd, 0);
|
||||
if (hswitch) {
|
||||
SWCNTRL swctl;
|
||||
WinQuerySwitchEntry(hswitch, &swctl);
|
||||
swctl.uchVisibility = aState ? SWL_VISIBLE : SWL_INVISIBLE;
|
||||
swctl.fbJump = aState ? SWL_JUMPABLE : SWL_NOTJUMPABLE;
|
||||
WinChangeSwitchEntry(hswitch, &swctl);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// nsFrameWindow's Window Procedure
|
||||
//=============================================================================
|
||||
|
||||
// Subclass for frame window
|
||||
MRESULT EXPENTRY fnwpFrame( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
||||
|
||||
MRESULT EXPENTRY fnwpFrame(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
||||
{
|
||||
// check to see if we have a rollup listener registered
|
||||
if (nsnull != gRollupListener && nsnull != gRollupWidget) {
|
||||
if (msg == WM_TRACKFRAME || msg == WM_MINMAXFRAME ||
|
||||
msg == WM_BUTTON1DOWN || msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN) {
|
||||
// Rollup if the event is outside the popup
|
||||
if (PR_FALSE == nsWindow::EventIsInsideWindow((nsWindow*)gRollupWidget)) {
|
||||
gRollupListener->Rollup(PR_UINT32_MAX, nsnull);
|
||||
|
||||
// if we are supposed to be consuming events and it is
|
||||
// a Mouse Button down, let it go through
|
||||
// if (gRollupConsumeRollupEvent && msg != WM_BUTTON1DOWN) {
|
||||
// return FALSE;
|
||||
// }
|
||||
}
|
||||
// check to see if we have a rollup listener registered
|
||||
if (gRollupListener && gRollupWidget) {
|
||||
if (msg == WM_TRACKFRAME || msg == WM_MINMAXFRAME ||
|
||||
msg == WM_BUTTON1DOWN || msg == WM_BUTTON2DOWN ||
|
||||
msg == WM_BUTTON3DOWN) {
|
||||
// Rollup if the event is outside the popup
|
||||
if (!nsWindow::EventIsInsideWindow((nsWindow*)gRollupWidget)) {
|
||||
gRollupListener->Rollup(PR_UINT32_MAX, nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsFrameWindow *pFrame = (nsFrameWindow*) WinQueryWindowPtr( hwnd, QWL_USER);
|
||||
return pFrame->FrameMessage( msg, mp1, mp2);
|
||||
nsFrameWindow* pFrame = (nsFrameWindow*)WinQueryWindowPtr(hwnd, QWL_USER);
|
||||
return pFrame->FrameMessage(msg, mp1, mp2);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Process messages from the frame
|
||||
MRESULT nsFrameWindow::FrameMessage( ULONG msg, MPARAM mp1, MPARAM mp2)
|
||||
|
||||
MRESULT nsFrameWindow::FrameMessage(ULONG msg, MPARAM mp1, MPARAM mp2)
|
||||
{
|
||||
MRESULT mresult = 0;
|
||||
BOOL bDone = FALSE;
|
||||
MRESULT mresult = 0;
|
||||
PRBool bDone = PR_FALSE;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
{
|
||||
PSWP pSwp = (PSWP) mp1;
|
||||
switch (msg) {
|
||||
case WM_WINDOWPOSCHANGED: {
|
||||
PSWP pSwp = (PSWP)mp1;
|
||||
|
||||
// Note that client windows never get 'move' messages (well, they won't here anyway)
|
||||
if( pSwp->fl & SWP_MOVE && !(pSwp->fl & SWP_MINIMIZE))
|
||||
{
|
||||
// These commented-out `-1's cancel each other out.
|
||||
POINTL ptl = { pSwp->x, pSwp->y + pSwp->cy /* - 1 */ };
|
||||
ptl.y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - ptl.y /* - 1*/ ;
|
||||
mBounds.x = ptl.x;
|
||||
mBounds.y = ptl.y;
|
||||
OnMove( ptl.x, ptl.y);
|
||||
}
|
||||
|
||||
// When the frame is sized, do stuff to recalculate client size.
|
||||
if( pSwp->fl & SWP_SIZE && !(pSwp->fl & SWP_MINIMIZE))
|
||||
{
|
||||
mresult = (*fnwpDefFrame)( mFrameWnd, msg, mp1, mp2);
|
||||
bDone = TRUE;
|
||||
|
||||
mBounds.width = pSwp->cx;
|
||||
mBounds.height = pSwp->cy;
|
||||
|
||||
UpdateClientSize();
|
||||
DispatchResizeEvent( mSizeClient.width, mSizeClient.height);
|
||||
}
|
||||
|
||||
if (pSwp->fl & (SWP_MAXIMIZE | SWP_MINIMIZE | SWP_RESTORE)) {
|
||||
nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this);
|
||||
if (pSwp->fl & SWP_MAXIMIZE)
|
||||
event.mSizeMode = nsSizeMode_Maximized;
|
||||
else if (pSwp->fl & SWP_MINIMIZE)
|
||||
event.mSizeMode = nsSizeMode_Minimized;
|
||||
else
|
||||
event.mSizeMode = nsSizeMode_Normal;
|
||||
InitEvent(event);
|
||||
DispatchWindowEvent(&event);
|
||||
}
|
||||
|
||||
break;
|
||||
// Note that client windows never get 'move' messages
|
||||
if (pSwp->fl & SWP_MOVE && !(pSwp->fl & SWP_MINIMIZE)) {
|
||||
POINTL ptl = { pSwp->x, pSwp->y + pSwp->cy };
|
||||
ptl.y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - ptl.y;
|
||||
mBounds.x = ptl.x;
|
||||
mBounds.y = ptl.y;
|
||||
DispatchMoveEvent(ptl.x, ptl.y);
|
||||
}
|
||||
|
||||
// a frame window in kiosk/fullscreen mode must have its frame
|
||||
// controls reattached before it's minimized & detached after it's
|
||||
// restored; if this doesn't happen at the correct times, clicking
|
||||
// on the icon won't restore it, the sysmenu will have the wrong
|
||||
// items, and/or the minmax button will have the wrong buttons
|
||||
// When the frame is sized, do stuff to recalculate client size.
|
||||
if (pSwp->fl & SWP_SIZE && !(pSwp->fl & SWP_MINIMIZE)) {
|
||||
mresult = (*mPrevFrameProc)(mFrameWnd, msg, mp1, mp2);
|
||||
bDone = PR_TRUE;
|
||||
mBounds.width = pSwp->cx;
|
||||
mBounds.height = pSwp->cy;
|
||||
UpdateClientSize();
|
||||
DispatchResizeEvent(mSizeClient.width, mSizeClient.height);
|
||||
}
|
||||
|
||||
case WM_ADJUSTWINDOWPOS:
|
||||
{
|
||||
if (mChromeHidden && ((PSWP)mp1)->fl & SWP_MINIMIZE) {
|
||||
HWND hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndMinMax");
|
||||
if (hwndTemp)
|
||||
WinSetParent(hwndTemp, mFrameWnd, TRUE);
|
||||
hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndTitleBar");
|
||||
if (hwndTemp)
|
||||
WinSetParent(hwndTemp, mFrameWnd, TRUE);
|
||||
hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndSysMenu");
|
||||
if (hwndTemp)
|
||||
WinSetParent(hwndTemp, mFrameWnd, TRUE);
|
||||
if (pSwp->fl & (SWP_MAXIMIZE | SWP_MINIMIZE | SWP_RESTORE)) {
|
||||
nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this);
|
||||
if (pSwp->fl & SWP_MAXIMIZE) {
|
||||
event.mSizeMode = nsSizeMode_Maximized;
|
||||
} else if (pSwp->fl & SWP_MINIMIZE) {
|
||||
event.mSizeMode = nsSizeMode_Minimized;
|
||||
} else {
|
||||
event.mSizeMode = nsSizeMode_Normal;
|
||||
}
|
||||
break;
|
||||
InitEvent(event);
|
||||
DispatchWindowEvent(&event);
|
||||
}
|
||||
case WM_ADJUSTFRAMEPOS:
|
||||
{
|
||||
if (mChromeHidden && ((PSWP)mp1)->fl & SWP_RESTORE) {
|
||||
HWND hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndSysMenu");
|
||||
if (hwndTemp)
|
||||
WinSetParent(hwndTemp, HWND_OBJECT, TRUE);
|
||||
hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndTitleBar");
|
||||
if (hwndTemp)
|
||||
WinSetParent(hwndTemp, HWND_OBJECT, TRUE);
|
||||
hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndMinMax");
|
||||
if (hwndTemp)
|
||||
WinSetParent(hwndTemp, HWND_OBJECT, TRUE);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// a frame window in kiosk/fullscreen mode must have its frame
|
||||
// controls reattached before it's minimized & detached after it's
|
||||
// restored; if this doesn't happen at the correct times, clicking
|
||||
// on the icon won't restore it, the sysmenu will have the wrong
|
||||
// items, and/or the minmax button will have the wrong buttons
|
||||
|
||||
case WM_ADJUSTWINDOWPOS: {
|
||||
if (mChromeHidden && ((PSWP)mp1)->fl & SWP_MINIMIZE) {
|
||||
HWND hTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndMinMax");
|
||||
if (hTemp) {
|
||||
WinSetParent(hTemp, mFrameWnd, TRUE);
|
||||
}
|
||||
hTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndTitleBar");
|
||||
if (hTemp) {
|
||||
WinSetParent(hTemp, mFrameWnd, TRUE);
|
||||
}
|
||||
hTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndSysMenu");
|
||||
if (hTemp) {
|
||||
WinSetParent(hTemp, mFrameWnd, TRUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
DEBUGFOCUS(frame WM_DESTROY);
|
||||
WinSubclassWindow( mFrameWnd, fnwpDefFrame);
|
||||
WinSetWindowPtr( mFrameWnd, QWL_USER, 0);
|
||||
WinRemoveProperty(mFrameWnd, "hwndTitleBar");
|
||||
WinRemoveProperty(mFrameWnd, "hwndSysMenu");
|
||||
WinRemoveProperty(mFrameWnd, "hwndMinMax");
|
||||
WinRemoveProperty(mFrameWnd, "ulStyle");
|
||||
break;
|
||||
case WM_INITMENU:
|
||||
/* If we are in fullscreen/kiosk mode, disable maximize menu item */
|
||||
if (mChromeHidden) {
|
||||
if (WinQueryWindowULong(mFrameWnd, QWL_STYLE) & WS_MINIMIZED) {
|
||||
if (SHORT1FROMMP(mp1) == SC_SYSMENU) {
|
||||
MENUITEM menuitem;
|
||||
WinSendMsg(WinWindowFromID(mFrameWnd, FID_SYSMENU), MM_QUERYITEM, MPFROM2SHORT(SC_SYSMENU, FALSE), MPARAM(&menuitem));
|
||||
mresult = (*fnwpDefFrame)( mFrameWnd, msg, mp1, mp2);
|
||||
WinEnableMenuItem(menuitem.hwndSubMenu, SC_MAXIMIZE, FALSE);
|
||||
bDone = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_SYSCOMMAND:
|
||||
/* If we are in fullscreen/kiosk mode, don't honor maximize requests */
|
||||
if (mChromeHidden) {
|
||||
if (WinQueryWindowULong(mFrameWnd, QWL_STYLE) & WS_MINIMIZED) {
|
||||
if ((SHORT1FROMMP(mp1) == SC_MAXIMIZE))
|
||||
{
|
||||
bDone = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_ADJUSTFRAMEPOS: {
|
||||
if (mChromeHidden && ((PSWP)mp1)->fl & SWP_RESTORE) {
|
||||
HWND hTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndSysMenu");
|
||||
if (hTemp) {
|
||||
WinSetParent(hTemp, HWND_OBJECT, TRUE);
|
||||
}
|
||||
hTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndTitleBar");
|
||||
if (hTemp) {
|
||||
WinSetParent(hTemp, HWND_OBJECT, TRUE);
|
||||
}
|
||||
hTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndMinMax");
|
||||
if (hTemp) {
|
||||
WinSetParent(hTemp, HWND_OBJECT, TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// When the frame is activated, set a flag to be acted on after
|
||||
// PM has finished changing focus. When deactivated, dispatch
|
||||
// the event immediately because it doesn't affect the focus.
|
||||
case WM_ACTIVATE:
|
||||
DEBUGFOCUS(WM_ACTIVATE);
|
||||
if (mp1) {
|
||||
mNeedActivation = PR_TRUE;
|
||||
} else {
|
||||
mNeedActivation = PR_FALSE;
|
||||
DEBUGFOCUS(NS_DEACTIVATE);
|
||||
DispatchFocus(NS_DEACTIVATE);
|
||||
// Prevent the frame from automatically focusing any window
|
||||
// when it's reactivated. Let moz set the focus to avoid
|
||||
// having non-widget children of plugins focused in error.
|
||||
WinSetWindowULong(mFrameWnd, QWL_HWNDFOCUSSAVE, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
DEBUGFOCUS(frame WM_DESTROY);
|
||||
WinSubclassWindow(mFrameWnd, mPrevFrameProc);
|
||||
WinSetWindowPtr(mFrameWnd, QWL_USER, 0);
|
||||
WinRemoveProperty(mFrameWnd, "hwndTitleBar");
|
||||
WinRemoveProperty(mFrameWnd, "hwndSysMenu");
|
||||
WinRemoveProperty(mFrameWnd, "hwndMinMax");
|
||||
WinRemoveProperty(mFrameWnd, "ulStyle");
|
||||
break;
|
||||
|
||||
if( !bDone)
|
||||
mresult = (*fnwpDefFrame)( mFrameWnd, msg, mp1, mp2);
|
||||
case WM_INITMENU:
|
||||
// If we are in fullscreen/kiosk mode, disable maximize menu item
|
||||
if (mChromeHidden &&
|
||||
SHORT1FROMMP(mp1) == SC_SYSMENU &&
|
||||
WinQueryWindowULong(mFrameWnd, QWL_STYLE) & WS_MINIMIZED) {
|
||||
MENUITEM menuitem;
|
||||
WinSendMsg(WinWindowFromID(mFrameWnd, FID_SYSMENU), MM_QUERYITEM,
|
||||
MPFROM2SHORT(SC_SYSMENU, FALSE), MPARAM(&menuitem));
|
||||
mresult = (*mPrevFrameProc)(mFrameWnd, msg, mp1, mp2);
|
||||
WinEnableMenuItem(menuitem.hwndSubMenu, SC_MAXIMIZE, FALSE);
|
||||
bDone = PR_TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
return mresult;
|
||||
case WM_SYSCOMMAND:
|
||||
// If we are in fullscreen/kiosk mode, don't honor maximize requests
|
||||
if (mChromeHidden &&
|
||||
SHORT1FROMMP(mp1) == SC_MAXIMIZE &&
|
||||
WinQueryWindowULong(mFrameWnd, QWL_STYLE) & WS_MINIMIZED) {
|
||||
bDone = PR_TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
// When the frame is activated, set a flag to be acted on after
|
||||
// PM has finished changing focus. When deactivated, dispatch
|
||||
// the event immediately because it doesn't affect the focus.
|
||||
case WM_ACTIVATE:
|
||||
DEBUGFOCUS(WM_ACTIVATE);
|
||||
if (mp1) {
|
||||
mNeedActivation = PR_TRUE;
|
||||
} else {
|
||||
mNeedActivation = PR_FALSE;
|
||||
DEBUGFOCUS(NS_DEACTIVATE);
|
||||
DispatchActivationEvent(NS_DEACTIVATE);
|
||||
// Prevent the frame from automatically focusing any window
|
||||
// when it's reactivated. Let moz set the focus to avoid
|
||||
// having non-widget children of plugins focused in error.
|
||||
WinSetWindowULong(mFrameWnd, QWL_HWNDFOCUSSAVE, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!bDone) {
|
||||
mresult = (*mPrevFrameProc)(mFrameWnd, msg, mp1, mp2);
|
||||
}
|
||||
|
||||
return mresult;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
@ -1,4 +1,7 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
/* vim: set sw=2 sts=2 et cin: */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
@ -19,6 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rich Walsh <dragtext@e-vertise.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@ -34,64 +38,72 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
//=============================================================================
|
||||
/*
|
||||
* nsFrameWindow is a subclass of nsWindow and is created when NS_WINDOW_CID
|
||||
* is specified. It represents a top-level widget and is implemented as two
|
||||
* native windows, a frame (WC_FRAME) and a client (MozillaWindowClass).
|
||||
*
|
||||
* Most methods inherited from nsIWidget are handled by nsWindow. For those
|
||||
* which require slightly different implementations for top-level and child
|
||||
* widgets, nsWindow relies on a flag or on virtual helper methods to handle
|
||||
* the differences properly.
|
||||
*
|
||||
* There are two items where these differences are particularly important:
|
||||
* - mWnd identifies the frame's client which is seldom acted upon directly;
|
||||
* instead, most operations involve mFrameWnd.
|
||||
* - mBounds contains the dimensions of mFrameWnd, not mWnd whose width and
|
||||
* height are stored in mSizeClient.
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
#ifndef _nsframewindow_h
|
||||
#define _nsframewindow_h
|
||||
|
||||
// Widget needs to treat the frame/client as one window - it's only really
|
||||
// interested in the client.
|
||||
//
|
||||
// mWnd is the client window; mBounds holds the frame rectangle relative to
|
||||
// the desktop.
|
||||
//
|
||||
// The frame itself is subclassed so OnMove events for the client happen.
|
||||
|
||||
#include "nsWindow.h"
|
||||
#include "nssize.h"
|
||||
|
||||
//=============================================================================
|
||||
// nsFrameWindow
|
||||
//=============================================================================
|
||||
|
||||
class nsFrameWindow : public nsWindow
|
||||
{
|
||||
public:
|
||||
nsFrameWindow();
|
||||
virtual ~nsFrameWindow();
|
||||
public:
|
||||
nsFrameWindow();
|
||||
virtual ~nsFrameWindow();
|
||||
|
||||
// So Destroy, Show, SetWindowPos, SetTitle, etc. work
|
||||
HWND GetMainWindow() const { return mFrameWnd; }
|
||||
// from nsIWidget
|
||||
virtual nsresult CreateWindow(nsWindow* aParent,
|
||||
HWND aParentWnd,
|
||||
const nsIntRect& aRect,
|
||||
PRUint32 aStyle);
|
||||
NS_IMETHOD Show(PRBool aState);
|
||||
NS_IMETHOD GetClientBounds(nsIntRect& aRect);
|
||||
|
||||
protected:
|
||||
PFNWP fnwpDefFrame;
|
||||
nsSize mSizeClient;
|
||||
nsSize mSizeBorder;
|
||||
PRBool mNeedActivation;
|
||||
protected:
|
||||
// from nsWindow
|
||||
virtual HWND GetMainWindow() const {return mFrameWnd;}
|
||||
virtual void ActivateTopLevelWidget();
|
||||
virtual PRBool OnReposition(PSWP pSwp);
|
||||
virtual PRInt32 GetClientHeight() {return mSizeClient.height;}
|
||||
|
||||
// Fires NS_ACTIVATE is mNeedActivation is set
|
||||
virtual void ActivateTopLevelWidget();
|
||||
// nsFrameWindow
|
||||
PRUint32 GetFCFlags();
|
||||
void UpdateClientSize();
|
||||
void SetWindowListVisibility(PRBool aState);
|
||||
MRESULT FrameMessage(ULONG msg, MPARAM mp1, MPARAM mp2);
|
||||
|
||||
// So we can create the frame, parent the client & position it right
|
||||
virtual void RealDoCreate( HWND hwndP, nsWindow *aParent,
|
||||
const nsIntRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsWidgetInitData *aInitData, HWND hwndO);
|
||||
friend MRESULT EXPENTRY fnwpFrame(HWND hwnd, ULONG msg,
|
||||
MPARAM mp1, MPARAM mp2);
|
||||
|
||||
// So correct sizing behaviour happens
|
||||
PRBool OnReposition( PSWP pSwp);
|
||||
|
||||
// Set up client sizes from frame dimensions
|
||||
void UpdateClientSize();
|
||||
PRInt32 GetClientHeight() { return mSizeClient.height; }
|
||||
|
||||
// So we can catch move messages
|
||||
MRESULT FrameMessage( ULONG msg, MPARAM mp1, MPARAM mp2);
|
||||
|
||||
NS_IMETHOD Show( PRBool bState);
|
||||
void SetWindowListVisibility( PRBool bState);
|
||||
|
||||
// We have client
|
||||
NS_IMETHOD GetClientBounds( nsIntRect &aRect);
|
||||
|
||||
friend MRESULT EXPENTRY fnwpFrame( HWND, ULONG, MPARAM, MPARAM);
|
||||
static BOOL fHiddenWindowCreated;
|
||||
PFNWP mPrevFrameProc;
|
||||
nsSize mSizeClient;
|
||||
PRBool mNeedActivation;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif //_nsframewindow_h
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
@ -37,8 +37,6 @@
|
||||
#ifndef _nsos2uni_h
|
||||
#define _nsos2uni_h
|
||||
|
||||
#define INCL_WIN
|
||||
#include <os2.h>
|
||||
#include <uconv.h>
|
||||
#include "nsTArray.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
|
@ -39,12 +39,7 @@
|
||||
#ifndef TOOLKIT_H
|
||||
#define TOOLKIT_H
|
||||
|
||||
#include "nsdefs.h"
|
||||
#include "prmon.h"
|
||||
#include "nsIToolkit.h"
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Wrapper around the thread running the message pump.
|
||||
|
@ -1,210 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is the Mozilla OS/2 libraries.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* John Fairhurst, <john_fairhurst@iname.com>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nswidgetdefs_h
|
||||
#define _nswidgetdefs_h
|
||||
|
||||
// OS/2 defines; for user messages & warp4 stuff, plus module-global data
|
||||
|
||||
#include "nsIWidget.h"
|
||||
|
||||
#define INCL_PM
|
||||
#define INCL_NLS
|
||||
#define INCL_DOS
|
||||
#define INCL_WINSTDFILE
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
|
||||
// TODO: The following two headers are required for their typedefs, although it
|
||||
// would be best to only include <uconv.h>. For EMX, we actually want to
|
||||
// include 'uniapi.h', but that results in an error without the #define
|
||||
#include <uconv.h>
|
||||
#define UNICHAR_TYPE_DEFINED // work around for EMX multiple typedef issue
|
||||
#include <unikbd.h>
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH CCHMAXPATH
|
||||
#endif
|
||||
|
||||
#ifndef OPENFILENAME
|
||||
/* OPENFILENAME struct flags
|
||||
*/
|
||||
|
||||
#define OFN_READONLY 0x00000001
|
||||
#define OFN_OVERWRITEPROMPT 0x00000002
|
||||
#define OFN_HIDEREADONLY 0x00000004
|
||||
#define OFN_NOCHANGEDIR 0x00000008
|
||||
#define OFN_SHOWHELP 0x00000010
|
||||
#define OFN_ENABLEHOOK 0x00000020
|
||||
#define OFN_ENABLETEMPLATE 0x00000040
|
||||
#define OFN_ENABLETEMPLATEHANDLE 0x00000080
|
||||
#define OFN_NOVALIDATE 0x00000100
|
||||
#define OFN_ALLOWMULTISELECT 0x00000200
|
||||
#define OFN_EXTENSIONDIFFERENT 0x00000400
|
||||
#define OFN_PATHMUSTEXIST 0x00000800
|
||||
#define OFN_FILEMUSTEXIST 0x00001000
|
||||
#define OFN_CREATEPROMPT 0x00002000
|
||||
#define OFN_SHAREAWARE 0x00004000
|
||||
#define OFN_NOREADONLYRETURN 0x00008000
|
||||
#define OFN_NOTESTFILECREATE 0x00010000
|
||||
#define OFN_NONETWORKBUTTON 0x00020000
|
||||
#define OFN_NOLONGNAMES 0x00040000
|
||||
|
||||
typedef struct _tagOFN {
|
||||
ULONG lStructSize;
|
||||
HWND hwndOwner;
|
||||
HMODULE hInstance;
|
||||
PCSZ lpstrFilter;
|
||||
PSZ lpstrCustomFilter;
|
||||
ULONG nMaxCustFilter;
|
||||
ULONG nFilterIndex;
|
||||
PSZ lpstrFile;
|
||||
ULONG nMaxFile;
|
||||
PSZ lpstrFileTitle;
|
||||
ULONG nMaxFileTitle;
|
||||
PCSZ lpstrInitialDir;
|
||||
PCSZ lpstrTitle;
|
||||
ULONG Flags;
|
||||
USHORT nFileOffset;
|
||||
USHORT nFileExtension;
|
||||
PCSZ lpstrDefExt;
|
||||
ULONG lCustData;
|
||||
PFN lpfnHook;
|
||||
PCSZ lpTemplateName;
|
||||
} OPENFILENAME, *POPENFILENAME, *LPOPENFILENAME;
|
||||
|
||||
extern "C" BOOL APIENTRY DaxOpenSave(BOOL, LONG *, LPOPENFILENAME, PFNWP);
|
||||
#endif
|
||||
|
||||
class nsDragService;
|
||||
class nsIAppShell;
|
||||
|
||||
// messages - here to avoid duplication
|
||||
#define WMU_CALLMETHOD (WM_USER + 1)
|
||||
#define WMU_SENDMSG (WM_USER + 2)
|
||||
|
||||
// MP1 is "LONG lIndex", MP2 is reserved
|
||||
#define WMU_SHOW_TOOLTIP (WM_USER + 3)
|
||||
|
||||
// MP1 & MP2 both reserved
|
||||
#define WMU_HIDE_TOOLTIP (WM_USER + 4)
|
||||
|
||||
// DRM_MOZILLA messages
|
||||
|
||||
// WMU_GETFLAVOURLEN
|
||||
//
|
||||
// mp1 - ULONG ulItemID Item ID from DRAGITEM
|
||||
// mp2 - HATOM hAtomFlavour Atom in the system table for the data flavour
|
||||
//
|
||||
// returns - ULONG ulSize Size in bytes of transfer data, 0 for error
|
||||
//
|
||||
#define WMU_GETFLAVOURLEN (WM_USER + 5)
|
||||
|
||||
typedef struct _WZDROPXFER
|
||||
{
|
||||
ATOM hAtomFlavour;
|
||||
CHAR data[1];
|
||||
} WZDROPXFER, *PWZDROPXFER;
|
||||
|
||||
// WMU_GETFLAVOURDATA
|
||||
//
|
||||
// mp1 - ULONG ulItemID Item ID from DRAGITEM
|
||||
// mp2 - PWZDROPXFER pvData Pointer to buffer to put data.
|
||||
// Must DosFreeMem().
|
||||
//
|
||||
// returns - BOOL bSuccess TRUE ok, FALSE error occurred.
|
||||
|
||||
#define WMU_GETFLAVOURDATA (WM_USER + 6)
|
||||
|
||||
#define WinIsKeyDown(vk) ((WinGetKeyState(HWND_DESKTOP,vk) & 0x8000) ? PR_TRUE : PR_FALSE)
|
||||
|
||||
// Tab control uses messages from TABM_BASE, which is currently (WM_USER+50).
|
||||
// See tabapi.h for details.
|
||||
|
||||
// MP2 is the other window.
|
||||
#ifndef WM_MOUSEENTER
|
||||
#define WM_MOUSEENTER 0x041E
|
||||
#endif
|
||||
#ifndef WM_MOUSELEAVE
|
||||
#define WM_MOUSELEAVE 0x041F
|
||||
#endif
|
||||
|
||||
#ifndef WM_FOCUSCHANGED
|
||||
#define WM_FOCUSCHANGED 0x000E
|
||||
#endif
|
||||
|
||||
#ifndef FCF_CLOSEBUTTON // defined in the Merlin toolkit
|
||||
#define FCF_CLOSEBUTTON 0x04000000L
|
||||
#endif
|
||||
|
||||
#ifndef FCF_DIALOGBOX
|
||||
#define FCF_DIALOGBOX 0x40000000L
|
||||
#endif
|
||||
|
||||
#ifndef DRT_URL
|
||||
#define DRT_URL "UniformResourceLocator"
|
||||
#endif
|
||||
|
||||
#define BASE_CONTROL_STYLE WS_TABSTOP
|
||||
|
||||
#define NS_MIT_END ((const PRUint32) MIT_END)
|
||||
|
||||
// A common pattern in widget is the 'Get/SetLabel' methods. These macros
|
||||
// can be used to fill in implementations who derive from nsWindow and just
|
||||
// want to call WinSet/QueryWindowText.
|
||||
|
||||
#define NS_DECL_LABEL \
|
||||
NS_IMETHOD SetLabel( const nsString &aText); \
|
||||
NS_IMETHOD GetLabel( nsString &aBuffer);
|
||||
|
||||
#define NS_IMPL_LABEL(_clsname) \
|
||||
nsresult _clsname::SetLabel( const nsString &aText) \
|
||||
{ \
|
||||
SetTitle( aText); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
\
|
||||
nsresult _clsname::GetLabel( nsString &aBuffer) \
|
||||
{ \
|
||||
PRUint32 dummy; \
|
||||
GetWindowText( aBuffer, &dummy); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
// can be used as an lvalue too.
|
||||
#define lastchar(s) *((s) + strlen((s)) - 1)
|
||||
|
||||
#endif
|
@ -59,8 +59,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
||||
//#include "nsWidgetDefs.h"
|
||||
|
||||
// class definition headers
|
||||
#include "nsAppShell.h"
|
||||
#include "nsAppShellSingleton.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,7 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
/* vim: set sw=2 sts=2 et cin: */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
@ -34,321 +37,261 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*
|
||||
* This Original Code has been modified by IBM Corporation.
|
||||
* Modifications made by IBM described herein are
|
||||
* Copyright (c) International Business Machines
|
||||
* Corporation, 2000
|
||||
*
|
||||
* Modifications to Mozilla code or documentation
|
||||
* identified per MPL Section 3.3
|
||||
*
|
||||
* Date Modified by Description of modification
|
||||
* 03/23/2000 IBM Corp. Added InvalidateRegion method.
|
||||
* 04/12/2000 IBM Corp. Changed params on DispatchMouseEvent to match Windows..
|
||||
* 04/14/2000 IBM Corp. Declared EventIsInsideWindow for CaptureRollupEvents
|
||||
* 06/15/2000 IBM Corp. Added NS2PM for rectangles
|
||||
* 06/21/2000 IBM Corp. Added CaptureMouse
|
||||
* Modifications made by IBM are
|
||||
* Copyright (c) International Business Machines Corporation, 2000
|
||||
*
|
||||
*/
|
||||
|
||||
//=============================================================================
|
||||
/*
|
||||
* nsWindow derives from nsIWidget via nsBaseWindow, and is created when
|
||||
* NS_CHILD_CID is specified. It is used for widgets that are either
|
||||
* children of other widgets or are popups (standalone windows such as
|
||||
* menus that float above other widgets).
|
||||
*
|
||||
* Top-level widgets (windows surrounded by a frame with a titlebar, etc.)
|
||||
* are implemented by nsFrameWindow which is a subclass of nsWindow. Many
|
||||
* nsWindow methods operate on both child & top-level windows. Where the
|
||||
* two categories require differing implementations, these methods rely on
|
||||
* a flag or on virtual helper methods to produce the correct result.
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
#ifndef _nswindow_h
|
||||
#define _nswindow_h
|
||||
|
||||
#include "nsWidgetDefs.h"
|
||||
#include "nsBaseWidget.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "gfxOS2Surface.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxASurface.h"
|
||||
|
||||
class imgIContainer;
|
||||
#define INCL_DOS
|
||||
#define INCL_WIN
|
||||
#define INCL_NLS
|
||||
#define INCL_GPI
|
||||
#include <os2.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Items that may not be in the OS/2 Toolkit headers
|
||||
|
||||
// For WM_MOUSEENTER/LEAVE, mp2 is the other window.
|
||||
#ifndef WM_MOUSEENTER
|
||||
#define WM_MOUSEENTER 0x041E
|
||||
#endif
|
||||
|
||||
#ifndef WM_MOUSELEAVE
|
||||
#define WM_MOUSELEAVE 0x041F
|
||||
#endif
|
||||
|
||||
#ifndef WM_FOCUSCHANGED
|
||||
#define WM_FOCUSCHANGED 0x000E
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
PVOID APIENTRY WinQueryProperty(HWND hwnd, PCSZ pszNameOrAtom);
|
||||
PVOID APIENTRY WinRemoveProperty(HWND hwnd, PCSZ pszNameOrAtom);
|
||||
BOOL APIENTRY WinSetProperty(HWND hwnd, PCSZ pszNameOrAtom,
|
||||
PVOID pvData, ULONG ulFlags);
|
||||
APIRET APIENTRY DosQueryModFromEIP(HMODULE* phMod, ULONG* pObjNum,
|
||||
ULONG BuffLen, PCHAR pBuff,
|
||||
ULONG* pOffset, ULONG Address);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Macros
|
||||
|
||||
// nsWindow's PM window class name
|
||||
#define kWindowClassName "MozillaWindowClass"
|
||||
#define QWL_NSWINDOWPTR (QWL_USER+4)
|
||||
|
||||
// Miscellaneous global flags stored in gOS2Flags
|
||||
#define kIsInitialized 0x0001
|
||||
#define kIsDBCS 0x0002
|
||||
#define kIsTrackPoint 0x0004
|
||||
|
||||
// Possible states of the window
|
||||
#define nsWindowState_ePrecreate 0x0001 // Create() not called yet
|
||||
#define nsWindowState_eInCreate 0x0002 // processing Create() method
|
||||
#define nsWindowState_eLive 0x0004 // active, existing window
|
||||
#define nsWindowState_eClosing 0x0008 // processing Close() method
|
||||
#define nsWindowState_eDoingDelete 0x0010 // object destructor running
|
||||
#define nsWindowState_eDead 0x0100 // window destroyed
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Debug
|
||||
|
||||
//#define DEBUG_FOCUS
|
||||
|
||||
#ifdef DEBUG_FOCUS
|
||||
#define DEBUGFOCUS(what) fprintf(stderr, "[%8x] %8lx (%02d) "#what"\n", (int)this, mWnd, mWindowIdentifier)
|
||||
#define DEBUGFOCUS(what) fprintf(stderr, "[%8x] %8lx (%02d) "#what"\n", \
|
||||
(int)this, mWnd, mWindowIdentifier)
|
||||
#else
|
||||
#define DEBUGFOCUS(what)
|
||||
#endif
|
||||
|
||||
// Base widget class.
|
||||
// This is abstract. Controls (labels, radio buttons, listboxen) derive
|
||||
// from here. A thing called a child window derives from here, and the
|
||||
// frame window class derives from the child.
|
||||
// nsFrameWindow is separate because work needs to be done there to decide
|
||||
// whether methods apply to frame or client.
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
|
||||
/* Possible states of the window, used to emulate windows better... */
|
||||
// default state; Create() not called
|
||||
#define nsWindowState_ePrecreate 0x00000001
|
||||
// processing Create() method
|
||||
#define nsWindowState_eInCreate 0x00000002
|
||||
// active, existing window
|
||||
#define nsWindowState_eLive 0x00000004
|
||||
//processing Close() method
|
||||
#define nsWindowState_eClosing 0x00000008
|
||||
// object destructor running
|
||||
#define nsWindowState_eDoingDelete 0x00000010
|
||||
// window destroyed
|
||||
#define nsWindowState_eDead 0x00000100
|
||||
class imgIContainer;
|
||||
class gfxOS2Surface;
|
||||
|
||||
MRESULT EXPENTRY fnwpNSWindow( HWND, ULONG, MPARAM, MPARAM);
|
||||
MRESULT EXPENTRY fnwpFrame( HWND, ULONG, MPARAM, MPARAM);
|
||||
MRESULT EXPENTRY fnwpNSWindow(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
||||
MRESULT EXPENTRY fnwpFrame(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
||||
|
||||
//=============================================================================
|
||||
// nsWindow
|
||||
//=============================================================================
|
||||
|
||||
class nsWindow : public nsBaseWidget
|
||||
{
|
||||
public:
|
||||
// Scaffolding
|
||||
nsWindow();
|
||||
virtual ~nsWindow();
|
||||
public:
|
||||
nsWindow();
|
||||
virtual ~nsWindow();
|
||||
|
||||
static void ReleaseGlobals();
|
||||
// from nsIWidget
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext* aContext,
|
||||
nsIAppShell* aAppShell = nsnull,
|
||||
nsIToolkit* aToolkit = nsnull,
|
||||
nsWidgetInitData* aInitData = nsnull);
|
||||
NS_IMETHOD Destroy();
|
||||
virtual nsIWidget* GetParent();
|
||||
NS_IMETHOD Enable(PRBool aState);
|
||||
NS_IMETHOD IsEnabled(PRBool* aState);
|
||||
NS_IMETHOD Show(PRBool aState);
|
||||
NS_IMETHOD IsVisible(PRBool& aState);
|
||||
NS_IMETHOD SetFocus(PRBool aRaise);
|
||||
NS_IMETHOD Invalidate(const nsIntRect& aRect,
|
||||
PRBool aIsSynchronous);
|
||||
NS_IMETHOD Update();
|
||||
gfxASurface* GetThebesSurface();
|
||||
virtual void* GetNativeData(PRUint32 aDataType);
|
||||
virtual void FreeNativeData(void* aDatum, PRUint32 aDataType);
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture);
|
||||
virtual PRBool HasPendingInputEvent();
|
||||
virtual void Scroll(const nsIntPoint& aDelta,
|
||||
const nsTArray<nsIntRect>& aDestRects,
|
||||
const nsTArray<Configuration>& aReconfigureChildren);
|
||||
NS_IMETHOD GetBounds(nsIntRect& aRect);
|
||||
NS_IMETHOD GetClientBounds(nsIntRect& aRect);
|
||||
virtual nsIntPoint WidgetToScreenOffset();
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight,
|
||||
PRBool aRepaint);
|
||||
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aWidth, PRInt32 aHeight,
|
||||
PRBool aRepaint);
|
||||
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
||||
nsIWidget* aWidget, PRBool aActivate);
|
||||
NS_IMETHOD SetZIndex(PRInt32 aZIndex);
|
||||
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
|
||||
NS_IMETHOD SetSizeMode(PRInt32 aMode);
|
||||
NS_IMETHOD HideWindowChrome(PRBool aShouldHide);
|
||||
NS_IMETHOD SetTitle(const nsAString& aTitle);
|
||||
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
|
||||
NS_IMETHOD ConstrainPosition(PRBool aAllowSlop,
|
||||
PRInt32* aX, PRInt32* aY);
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
||||
PRUint32 aHotspotX, PRUint32 aHotspotY);
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener* aListener,
|
||||
nsIMenuRollup* aMenuRollup,
|
||||
PRBool aDoCapture, PRBool aConsumeRollupEvent);
|
||||
NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode,
|
||||
PRBool* aLEDState);
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event,
|
||||
nsEventStatus& aStatus);
|
||||
|
||||
// nsIWidget
|
||||
|
||||
// Creation from native widget parent or nsIWidget parent, destroy
|
||||
NS_IMETHOD Create( nsIWidget *aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
gfxASurface* GetThebesSurface();
|
||||
NS_IMETHOD Destroy(); // call before releasing
|
||||
|
||||
// Hierarchy: only interested in widget children (it seems)
|
||||
virtual nsIWidget *GetParent();
|
||||
|
||||
NS_IMETHOD SetSizeMode(PRInt32 aMode);
|
||||
|
||||
// Physical properties
|
||||
NS_IMETHOD Show( PRBool bState);
|
||||
NS_IMETHOD ConstrainPosition(PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY);
|
||||
NS_IMETHOD Move( PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD Resize( PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
PRBool aRepaint);
|
||||
NS_IMETHOD Resize( PRInt32 aX,
|
||||
PRInt32 aY,
|
||||
PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
PRBool aRepaint);
|
||||
NS_IMETHOD GetClientBounds( nsIntRect &aRect);
|
||||
NS_IMETHOD Enable( PRBool aState);
|
||||
NS_IMETHOD IsEnabled(PRBool *aState);
|
||||
NS_IMETHOD SetFocus(PRBool aRaise);
|
||||
NS_IMETHOD GetBounds(nsIntRect &aRect);
|
||||
NS_IMETHOD IsVisible( PRBool &aState);
|
||||
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
||||
nsIWidget *aWidget, PRBool aActivate);
|
||||
NS_IMETHOD SetZIndex(PRInt32 aZIndex);
|
||||
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture);
|
||||
|
||||
virtual nsIntPoint WidgetToScreenOffset();
|
||||
NS_IMETHOD DispatchEvent( struct nsGUIEvent *event, nsEventStatus &aStatus);
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, nsIMenuRollup * aMenuRollup,
|
||||
PRBool aDoCapture, PRBool aConsumeRollupEvent);
|
||||
|
||||
virtual PRBool HasPendingInputEvent();
|
||||
|
||||
// Widget appearance
|
||||
NS_IMETHOD SetCursor( nsCursor aCursor);
|
||||
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
||||
PRUint32 aHotspotX, PRUint32 aHotspotY);
|
||||
NS_IMETHOD HideWindowChrome(PRBool aShouldHide);
|
||||
NS_IMETHOD SetTitle( const nsAString& aTitle);
|
||||
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
|
||||
NS_IMETHOD Invalidate( const nsIntRect & aRect, PRBool aIsSynchronous);
|
||||
NS_IMETHOD Update();
|
||||
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
|
||||
virtual void Scroll(const nsIntPoint& aDelta,
|
||||
const nsTArray<nsIntRect>& aDestRects,
|
||||
const nsTArray<Configuration>& aReconfigureChildren);
|
||||
NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState);
|
||||
|
||||
// Get a HWND or a HPS.
|
||||
virtual void *GetNativeData( PRUint32 aDataType);
|
||||
virtual void FreeNativeData( void *aDatum, PRUint32 aDataType);
|
||||
virtual HWND GetMainWindow() const { return mWnd; }
|
||||
|
||||
// PM methods which need to be public (menus, etc)
|
||||
ULONG GetNextID() { return mNextID++; }
|
||||
void NS2PM_PARENT( POINTL &ptl);
|
||||
void NS2PM( POINTL &ptl);
|
||||
void NS2PM( RECTL &rcl);
|
||||
// nsWindow
|
||||
static void ReleaseGlobals();
|
||||
|
||||
protected:
|
||||
static BOOL DealWithPopups ( ULONG inMsg, MRESULT* outResult ) ;
|
||||
// from nsBaseWidget
|
||||
virtual void OnDestroy();
|
||||
|
||||
static PRBool EventIsInsideWindow(nsWindow* aWindow);
|
||||
// nsWindow
|
||||
static void InitGlobals();
|
||||
virtual nsresult CreateWindow(nsWindow* aParent,
|
||||
HWND aParentWnd,
|
||||
const nsIntRect& aRect,
|
||||
PRUint32 aStyle);
|
||||
virtual HWND GetMainWindow() const {return mWnd;}
|
||||
static nsWindow* GetNSWindowPtr(HWND aWnd);
|
||||
static PRBool SetNSWindowPtr(HWND aWnd, nsWindow* aPtr);
|
||||
void NS2PM(POINTL& ptl);
|
||||
void NS2PM(RECTL& rcl);
|
||||
void NS2PM_PARENT(POINTL& ptl);
|
||||
void ActivatePlugin(HWND aWnd);
|
||||
void SetPluginClipRegion(const Configuration& aConfiguration);
|
||||
HWND GetPluginClipWindow(HWND aParentWnd);
|
||||
virtual void ActivateTopLevelWidget();
|
||||
HBITMAP DataToBitmap(PRUint8* aImageData, PRUint32 aWidth,
|
||||
PRUint32 aHeight, PRUint32 aDepth);
|
||||
HBITMAP CreateBitmapRGB(PRUint8* aImageData,
|
||||
PRUint32 aWidth, PRUint32 aHeight);
|
||||
HBITMAP CreateTransparencyMask(gfxASurface::gfxImageFormat format,
|
||||
PRUint8* aImageData,
|
||||
PRUint32 aWidth, PRUint32 aHeight);
|
||||
static PRBool EventIsInsideWindow(nsWindow* aWindow);
|
||||
static PRBool RollupOnButtonDown(ULONG aMsg);
|
||||
static void RollupOnFocusLost(HWND aFocus);
|
||||
MRESULT ProcessMessage(ULONG msg, MPARAM mp1, MPARAM mp2);
|
||||
virtual PRBool OnReposition(PSWP pNewSwp);
|
||||
PRBool OnPaint();
|
||||
PRBool OnMouseChord(MPARAM mp1, MPARAM mp2);
|
||||
PRBool OnDragDropMsg(ULONG msg, MPARAM mp1, MPARAM mp2,
|
||||
MRESULT& mr);
|
||||
PRBool CheckDragStatus(PRUint32 aAction, HPS* aHps);
|
||||
PRBool ReleaseIfDragHPS(HPS aHps);
|
||||
PRBool OnTranslateAccelerator(PQMSG pQmsg);
|
||||
PRBool DispatchKeyEvent(MPARAM mp1, MPARAM mp2);
|
||||
void InitEvent(nsGUIEvent& event, nsIntPoint* pt = 0);
|
||||
PRBool DispatchWindowEvent(nsGUIEvent* event);
|
||||
PRBool DispatchWindowEvent(nsGUIEvent* event,
|
||||
nsEventStatus& aStatus);
|
||||
PRBool DispatchCommandEvent(PRUint32 aEventCommand);
|
||||
PRBool DispatchDragDropEvent(PRUint32 aMsg);
|
||||
PRBool DispatchMoveEvent(PRInt32 aX, PRInt32 aY);
|
||||
PRBool DispatchResizeEvent(PRInt32 aClientX,
|
||||
PRInt32 aClientY);
|
||||
PRBool DispatchMouseEvent(PRUint32 aEventType,
|
||||
MPARAM mp1, MPARAM mp2,
|
||||
PRBool aIsContextMenuKey = PR_FALSE,
|
||||
PRInt16 aButton = nsMouseEvent::eLeftButton);
|
||||
PRBool DispatchActivationEvent(PRUint32 aEventType);
|
||||
PRBool DispatchScrollEvent(ULONG msg, MPARAM mp1, MPARAM mp2);
|
||||
virtual PRInt32 GetClientHeight() {return mBounds.height;}
|
||||
|
||||
static nsWindow * GetNSWindowPtr(HWND aWnd);
|
||||
static BOOL SetNSWindowPtr(HWND aWnd, nsWindow * ptr);
|
||||
friend MRESULT EXPENTRY fnwpNSWindow(HWND hwnd, ULONG msg,
|
||||
MPARAM mp1, MPARAM mp2);
|
||||
friend MRESULT EXPENTRY fnwpFrame(HWND hwnd, ULONG msg,
|
||||
MPARAM mp1, MPARAM mp2);
|
||||
|
||||
static nsWindow* gCurrentWindow;
|
||||
// nsWindow methods subclasses must provide for creation to work
|
||||
virtual PCSZ WindowClass();
|
||||
virtual ULONG WindowStyle();
|
||||
|
||||
// hooks subclasses may wish to override!
|
||||
virtual void PostCreateWidget() {}
|
||||
virtual PRInt32 GetClientHeight() { return mBounds.height; }
|
||||
virtual void SetupForPrint( HWND /*hwnd*/) {}
|
||||
|
||||
// Useful functions for subclasses to use, threaded as necessary.
|
||||
virtual nsresult GetWindowText( nsString &str, PRUint32 *rc);
|
||||
virtual void AddToStyle( ULONG style);
|
||||
virtual void RemoveFromStyle( ULONG style);
|
||||
|
||||
// Message handlers - may wish to override. Default implementation for
|
||||
// control, paint & scroll is to do nothing.
|
||||
|
||||
// Return whether message has been processed.
|
||||
virtual PRBool ProcessMessage( ULONG m, MPARAM p1, MPARAM p2, MRESULT &r);
|
||||
|
||||
void ActivatePlugin(HWND aWnd);
|
||||
virtual void ActivateTopLevelWidget();
|
||||
virtual PRBool OnPaint();
|
||||
virtual void OnDestroy();
|
||||
virtual PRBool OnReposition( PSWP pNewSwp);
|
||||
virtual PRBool OnResize( PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnMove( PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnKey( MPARAM mp1, MPARAM mp2);
|
||||
virtual PRBool DispatchFocus( PRUint32 aEventType);
|
||||
virtual PRBool OnScroll( ULONG msgid, MPARAM mp1, MPARAM mp2);
|
||||
virtual PRBool OnVScroll( MPARAM mp1, MPARAM mp2);
|
||||
virtual PRBool OnHScroll( MPARAM mp1, MPARAM mp2);
|
||||
virtual PRBool OnControl( MPARAM mp1, MPARAM mp2);
|
||||
// called after param has been set...
|
||||
virtual PRBool OnPresParamChanged( MPARAM mp1, MPARAM mp2);
|
||||
virtual PRBool OnDragDropMsg(ULONG msg, MPARAM mp1, MPARAM mp2, MRESULT &mr);
|
||||
|
||||
static BOOL sIsRegistered;
|
||||
|
||||
// PM data members
|
||||
HWND mWnd; // window handle
|
||||
HWND mFrameWnd; // frame window handle
|
||||
PFNWP mPrevWndProc; // previous window procedure
|
||||
nsWindow *mParent; // parent widget
|
||||
ULONG mNextID; // next child window id
|
||||
HPOINTER mFrameIcon; // current frame icon
|
||||
VDKEY mDeadKey; // dead key from previous keyevent
|
||||
BOOL mHaveDeadKey; // is mDeadKey valid [0 may be a valid dead key, for all I know]
|
||||
QMSG mQmsg;
|
||||
PRBool mIsTopWidgetWindow;
|
||||
BOOL mIsScrollBar;
|
||||
BOOL mIsDestroying;
|
||||
BOOL mInSetFocus;
|
||||
BOOL mChromeHidden;
|
||||
nsContentType mContentType;
|
||||
HPS mDragHps; // retrieved by DrgGetPS() during a drag
|
||||
PRUint32 mDragStatus; // set while this object is being dragged over
|
||||
HPOINTER mCssCursorHPtr; // created by SetCursor(imgIContainer*)
|
||||
nsCOMPtr<imgIContainer> mCssCursorImg; // saved by SetCursor(imgIContainer*)
|
||||
HWND mClipWnd; // used to clip plugin windows
|
||||
|
||||
HWND GetParentHWND() const;
|
||||
HWND GetHWND() const { return mWnd; }
|
||||
PFNWP GetPrevWP() const { return mPrevWndProc; }
|
||||
|
||||
// nglayout data members
|
||||
nsToolkit *mOS2Toolkit;
|
||||
PRInt32 mWindowState;
|
||||
nsRefPtr<gfxOS2Surface> mThebesSurface;
|
||||
|
||||
// Implementation ------------------------------
|
||||
void DoCreate( HWND hwndP, nsWindow *wndP, const nsIntRect &rect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext, nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit, nsWidgetInitData *aInitData);
|
||||
|
||||
virtual void RealDoCreate( HWND hwndP, nsWindow *aParent,
|
||||
const nsIntRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsWidgetInitData *aInitData,
|
||||
HWND hwndOwner = 0);
|
||||
|
||||
// hook so dialog can be created looking like a dialog
|
||||
virtual ULONG GetFCFlags();
|
||||
|
||||
virtual void SubclassWindow(BOOL bState);
|
||||
|
||||
PRBool ConvertStatus( nsEventStatus aStatus)
|
||||
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
||||
void InitEvent( nsGUIEvent &event, nsIntPoint *pt = 0);
|
||||
virtual PRBool DispatchWindowEvent(nsGUIEvent* event);
|
||||
virtual PRBool DispatchWindowEvent(nsGUIEvent*event, nsEventStatus &aStatus);
|
||||
PRBool DispatchStandardEvent( PRUint32 aMsg);
|
||||
PRBool DispatchCommandEvent(PRUint32 aEventCommand);
|
||||
PRBool DispatchDragDropEvent( PRUint32 aMsg);
|
||||
virtual PRBool DispatchMouseEvent(PRUint32 aEventType, MPARAM mp1, MPARAM mp2,
|
||||
PRBool aIsContextMenuKey = PR_FALSE,
|
||||
PRInt16 aButton = nsMouseEvent::eLeftButton);
|
||||
virtual PRBool DispatchResizeEvent( PRInt32 aClientX, PRInt32 aClientY);
|
||||
void GetNonClientBounds(nsIntRect &aRect);
|
||||
void ConstrainZLevel(HWND *aAfter);
|
||||
|
||||
PRBool CheckDragStatus(PRUint32 aAction, HPS * oHps);
|
||||
PRBool ReleaseIfDragHPS(HPS aHps);
|
||||
|
||||
HBITMAP DataToBitmap(PRUint8* aImageData, PRUint32 aWidth,
|
||||
PRUint32 aHeight, PRUint32 aDepth);
|
||||
HBITMAP CreateBitmapRGB(PRUint8* aImageData, PRUint32 aWidth, PRUint32 aHeight);
|
||||
HBITMAP CreateTransparencyMask(gfxASurface::gfxImageFormat format,
|
||||
PRUint8* aImageData, PRUint32 aWidth, PRUint32 aHeight);
|
||||
|
||||
void SetPluginClipRegion(const Configuration& aConfiguration);
|
||||
HWND GetPluginClipWindow(HWND aParentWnd);
|
||||
|
||||
// Enumeration of the methods which are accessible on the PM thread
|
||||
enum {
|
||||
CREATE,
|
||||
DESTROY,
|
||||
SET_FOCUS,
|
||||
UPDATE_WINDOW,
|
||||
SET_TITLE,
|
||||
GET_TITLE
|
||||
};
|
||||
friend MRESULT EXPENTRY fnwpNSWindow( HWND, ULONG, MPARAM, MPARAM);
|
||||
friend MRESULT EXPENTRY fnwpFrame( HWND, ULONG, MPARAM, MPARAM);
|
||||
HWND mWnd; // window handle
|
||||
nsWindow* mParent; // parent widget
|
||||
PRBool mIsTopWidgetWindow; // is nsFrameWindow class?
|
||||
PRInt32 mWindowState; // current nsWindowState_* value
|
||||
PRBool mIsDestroying; // in destructor
|
||||
PRBool mInSetFocus; // prevent recursive calls
|
||||
HPS mDragHps; // retrieved by DrgGetPS() during a drag
|
||||
PRUint32 mDragStatus; // set when object is being dragged over
|
||||
HWND mClipWnd; // used to clip plugin windows
|
||||
HPOINTER mCssCursorHPtr; // created by SetCursor(imgIContainer*)
|
||||
nsCOMPtr<imgIContainer> mCssCursorImg;// saved by SetCursor(imgIContainer*)
|
||||
nsRefPtr<gfxOS2Surface> mThebesSurface;
|
||||
HWND mFrameWnd; // frame window handle
|
||||
HPOINTER mFrameIcon; // current frame icon
|
||||
PRBool mChromeHidden; // are frame controls hidden?
|
||||
#ifdef DEBUG_FOCUS
|
||||
int mWindowIdentifier;
|
||||
int mWindowIdentifier; // a serial number for each new window
|
||||
#endif
|
||||
};
|
||||
|
||||
#define PM2NS_PARENT NS2PM_PARENT
|
||||
#define PM2NS NS2PM
|
||||
#endif // _nswindow_h
|
||||
|
||||
#define PMSCAN_PADMULT 0x37
|
||||
#define PMSCAN_PAD7 0x47
|
||||
#define PMSCAN_PAD8 0x48
|
||||
#define PMSCAN_PAD9 0x49
|
||||
#define PMSCAN_PADMINUS 0x4A
|
||||
#define PMSCAN_PAD4 0x4B
|
||||
#define PMSCAN_PAD5 0x4C
|
||||
#define PMSCAN_PAD6 0x4D
|
||||
#define PMSCAN_PADPLUS 0x4E
|
||||
#define PMSCAN_PAD1 0x4F
|
||||
#define PMSCAN_PAD2 0x50
|
||||
#define PMSCAN_PAD3 0x51
|
||||
#define PMSCAN_PAD0 0x52
|
||||
#define PMSCAN_PADPERIOD 0x53
|
||||
#define PMSCAN_PADDIV 0x5c
|
||||
//=============================================================================
|
||||
|
||||
#define isNumPadScanCode(scanCode) !( (scanCode < PMSCAN_PAD7) || \
|
||||
(scanCode > PMSCAN_PADPERIOD) || \
|
||||
(scanCode == PMSCAN_PADMULT) || \
|
||||
(scanCode == PMSCAN_PADDIV) || \
|
||||
(scanCode == PMSCAN_PADMINUS) || \
|
||||
(scanCode == PMSCAN_PADPLUS) )
|
||||
#define isNumlockOn (BOOL)WinGetKeyState(HWND_DESKTOP, VK_NUMLOCK) & 0x0001
|
||||
|
||||
extern PRUint32 WMChar2KeyCode( MPARAM mp1, MPARAM mp2);
|
||||
|
||||
extern nsWindow *NS_HWNDToWindow( HWND hwnd);
|
||||
|
||||
#endif
|
||||
|
@ -1,80 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef NSDEFS_H
|
||||
#define NSDEFS_H
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define INCL_WINERRORS
|
||||
#endif
|
||||
#define INCL_WIN
|
||||
#define INCL_DOS
|
||||
#define INCL_GPI
|
||||
#include <os2.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define BREAK_TO_DEBUGGER asm("int $3")
|
||||
#else
|
||||
#define BREAK_TO_DEBUGGER
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define VERIFY(exp) if (!(exp)) { WinGetLastError((HAB)0); BREAK_TO_DEBUGGER; }
|
||||
#else // !_DEBUG
|
||||
#define VERIFY(exp) (exp)
|
||||
#endif // !_DEBUG
|
||||
|
||||
#define WC_SCROLLBAR_STRING "#8" //string equivalent to WC_SCROLLBAR
|
||||
#define WC_FRAME_STRING "#1" //string equivalent to WC_FRAME
|
||||
|
||||
|
||||
extern "C" {
|
||||
PVOID APIENTRY WinQueryProperty(HWND hwnd, PCSZ pszNameOrAtom);
|
||||
|
||||
PVOID APIENTRY WinRemoveProperty(HWND hwnd, PCSZ pszNameOrAtom);
|
||||
|
||||
BOOL APIENTRY WinSetProperty(HWND hwnd, PCSZ pszNameOrAtom,
|
||||
PVOID pvData, ULONG ulFlags);
|
||||
|
||||
APIRET APIENTRY DosQueryModFromEIP(HMODULE *phMod, ULONG *pObjNum,
|
||||
ULONG BuffLen, PCHAR pBuff,
|
||||
ULONG *pOffset, ULONG Address);
|
||||
}
|
||||
|
||||
#endif // NSDEFS_H
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user