Partial fix for bug 331630. Remove nsEventStatus_eConsumeDoDefault from widget code. r+sr=roc@ocallahan.org
This commit is contained in:
Родитель
f3191b9ec2
Коммит
3336ccb2cb
|
@ -369,29 +369,6 @@ NS_METHOD nsWindow::ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect)
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Convert nsEventStatus value to a windows boolean
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
PRBool nsWindow::ConvertStatus(nsEventStatus aStatus)
|
||||
{
|
||||
switch(aStatus)
|
||||
{
|
||||
case nsEventStatus_eIgnore:
|
||||
return PR_FALSE;
|
||||
case nsEventStatus_eConsumeNoDefault:
|
||||
return PR_TRUE;
|
||||
case nsEventStatus_eConsumeDoDefault:
|
||||
return PR_FALSE;
|
||||
default:
|
||||
NS_ASSERTION(0, "Illegal nsEventStatus enumeration value");
|
||||
break;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Initialize an event to dispatch
|
||||
|
|
|
@ -210,7 +210,8 @@ protected:
|
|||
PRBool DispatchKeyEvent(PRUint32 aEventType, PRUint32 aCharCode,
|
||||
PRUint32 aKeyCode, PRUint32 aFlags = 0);
|
||||
PRBool DispatchFocus(PRUint32 aEventType);
|
||||
static PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
static PRBool ConvertStatus(nsEventStatus aStatus)
|
||||
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
||||
PRBool DispatchStandardEvent(PRUint32 aMsg);
|
||||
|
||||
PRBool DispatchWindowEvent(nsGUIEvent* event);
|
||||
|
|
|
@ -216,7 +216,8 @@ public:
|
|||
NS_IMETHOD BeginResizingChildren(void);
|
||||
NS_IMETHOD EndResizingChildren(void);
|
||||
|
||||
static PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
static PRBool ConvertStatus(nsEventStatus aStatus)
|
||||
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
||||
virtual PRBool DispatchMouseEvent(nsMouseEvent &aEvent);
|
||||
|
||||
|
|
|
@ -1579,25 +1579,6 @@ NS_IMETHODIMP nsChildView::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
PRBool nsChildView::ConvertStatus(nsEventStatus aStatus)
|
||||
{
|
||||
switch (aStatus)
|
||||
{
|
||||
case nsEventStatus_eIgnore: return(PR_FALSE);
|
||||
case nsEventStatus_eConsumeNoDefault: return(PR_TRUE); // don't do default processing
|
||||
case nsEventStatus_eConsumeDoDefault: return(PR_FALSE);
|
||||
default:
|
||||
NS_ASSERTION(0, "Illegal nsEventStatus enumeration value");
|
||||
break;
|
||||
}
|
||||
return(PR_FALSE);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Invokes callback and ProcessEvent method on Event Listener object
|
||||
|
|
|
@ -1422,22 +1422,6 @@ void nsWidget::InitEvent(nsGUIEvent& event, nsPoint* aPoint)
|
|||
gdk_event_free(ge);
|
||||
}
|
||||
|
||||
PRBool nsWidget::ConvertStatus(nsEventStatus aStatus)
|
||||
{
|
||||
switch(aStatus) {
|
||||
case nsEventStatus_eIgnore:
|
||||
return(PR_FALSE);
|
||||
case nsEventStatus_eConsumeNoDefault:
|
||||
return(PR_TRUE);
|
||||
case nsEventStatus_eConsumeDoDefault:
|
||||
return(PR_FALSE);
|
||||
default:
|
||||
NS_ASSERTION(0, "Illegal nsEventStatus enumeration value");
|
||||
break;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsWidget::DispatchWindowEvent(nsGUIEvent* event)
|
||||
{
|
||||
nsEventStatus status;
|
||||
|
|
|
@ -182,7 +182,8 @@ public:
|
|||
|
||||
// Utility functions
|
||||
|
||||
PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
PRBool ConvertStatus(nsEventStatus aStatus)
|
||||
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
||||
PRBool DispatchMouseEvent(nsMouseEvent& aEvent);
|
||||
PRBool DispatchStandardEvent(PRUint32 aMsg);
|
||||
PRBool DispatchFocus(nsGUIEvent &aEvent);
|
||||
|
|
|
@ -1768,25 +1768,6 @@ scrollChildren:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
PRBool nsWindow::ConvertStatus(nsEventStatus aStatus)
|
||||
{
|
||||
switch (aStatus)
|
||||
{
|
||||
case nsEventStatus_eIgnore: return(PR_FALSE);
|
||||
case nsEventStatus_eConsumeNoDefault: return(PR_TRUE); // don't do default processing
|
||||
case nsEventStatus_eConsumeDoDefault: return(PR_FALSE);
|
||||
default:
|
||||
NS_ERROR("Illegal nsEventStatus enumeration value");
|
||||
break;
|
||||
}
|
||||
return(PR_FALSE);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Invokes callback and ProcessEvent method on Event Listener object
|
||||
|
|
|
@ -174,7 +174,8 @@ public:
|
|||
NS_IMETHOD BeginResizingChildren(void);
|
||||
NS_IMETHOD EndResizingChildren(void);
|
||||
|
||||
static PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
static PRBool ConvertStatus(nsEventStatus aStatus)
|
||||
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
||||
virtual PRBool DispatchMouseEvent(nsMouseEvent &aEvent);
|
||||
|
||||
|
|
|
@ -404,28 +404,6 @@ NS_METHOD nsWindow::ScreenToWidget( const nsRect &aOldRect, nsRect &aNewRect)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Convert nsEventStatus value to a windows boolean
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
PRBool nsWindow::ConvertStatus(nsEventStatus aStatus)
|
||||
{
|
||||
switch(aStatus) {
|
||||
case nsEventStatus_eIgnore:
|
||||
return PR_FALSE;
|
||||
case nsEventStatus_eConsumeNoDefault:
|
||||
return PR_TRUE;
|
||||
case nsEventStatus_eConsumeDoDefault:
|
||||
return PR_FALSE;
|
||||
default:
|
||||
NS_ASSERTION(0, "Illegal nsEventStatus enumeration value");
|
||||
break;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Initialize an event to dispatch
|
||||
|
|
|
@ -314,7 +314,8 @@ protected:
|
|||
|
||||
virtual void SubclassWindow(BOOL bState);
|
||||
|
||||
PRBool ConvertStatus( nsEventStatus aStatus);
|
||||
PRBool ConvertStatus( nsEventStatus aStatus)
|
||||
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
||||
void InitEvent( nsGUIEvent &event, nsPoint *pt = 0);
|
||||
virtual PRBool DispatchWindowEvent(nsGUIEvent* event);
|
||||
virtual PRBool DispatchWindowEvent(nsGUIEvent*event, nsEventStatus &aStatus);
|
||||
|
|
|
@ -239,15 +239,7 @@ public:
|
|||
|
||||
inline PRBool ConvertStatus(nsEventStatus aStatus)
|
||||
{
|
||||
switch(aStatus) {
|
||||
case nsEventStatus_eIgnore:
|
||||
case nsEventStatus_eConsumeDoDefault:
|
||||
return(PR_FALSE);
|
||||
case nsEventStatus_eConsumeNoDefault:
|
||||
return(PR_TRUE);
|
||||
}
|
||||
NS_ASSERTION(0, "Illegal nsEventStatus enumeration value");
|
||||
return PR_FALSE;
|
||||
return aStatus == nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
PRBool DispatchMouseEvent(nsMouseEvent& aEvent);
|
||||
|
|
|
@ -1504,25 +1504,6 @@ NS_METHOD nsCommonWidget::SetCursor(nsCursor aCursor)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool nsCommonWidget::ignoreEvent(nsEventStatus aStatus) const
|
||||
{
|
||||
switch(aStatus) {
|
||||
case nsEventStatus_eIgnore:
|
||||
return(PR_FALSE);
|
||||
|
||||
case nsEventStatus_eConsumeNoDefault:
|
||||
return(PR_TRUE);
|
||||
|
||||
case nsEventStatus_eConsumeDoDefault:
|
||||
return(PR_FALSE);
|
||||
|
||||
default:
|
||||
NS_ASSERTION(0,"Illegal nsEventStatus enumeration value");
|
||||
break;
|
||||
}
|
||||
return(PR_FALSE);
|
||||
}
|
||||
|
||||
NS_METHOD nsCommonWidget::SetModal(PRBool aModal)
|
||||
{
|
||||
#ifdef DEBUG_WIDGETS
|
||||
|
|
|
@ -1,214 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** 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
|
||||
* Zack Rusin <zack@kde.org>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Lars Knoll <knoll@kde.org>
|
||||
* Zack Rusin <zack@kde.org>
|
||||
*
|
||||
* 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 NSCOMMONWIDGET_H
|
||||
#define NSCOMMONWIDGET_H
|
||||
|
||||
#include "nsBaseWidget.h"
|
||||
|
||||
#include "nsEvent.h"
|
||||
|
||||
#include <qevent.h> //XXX switch for forward-decl
|
||||
|
||||
class nsIToolkit;
|
||||
class nsWidgetInitData;
|
||||
class nsIDeviceContext;
|
||||
class nsIAppShell;
|
||||
class nsIFontMetrics;
|
||||
class nsColorMap;
|
||||
class nsFont;
|
||||
class nsRect;
|
||||
class nsAString;
|
||||
class nsIMenuBar;
|
||||
class nsGUIEvent;
|
||||
class nsIRollupListener;
|
||||
class QWidget;
|
||||
class nsQtEventDispatcher;
|
||||
|
||||
class nsCommonWidget : public nsBaseWidget
|
||||
{
|
||||
public:
|
||||
nsCommonWidget();
|
||||
~nsCommonWidget();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_IMETHOD Show(PRBool);
|
||||
NS_IMETHOD IsVisible(PRBool&);
|
||||
|
||||
NS_IMETHOD ConstrainPosition(PRBool, PRInt32*, PRInt32*);
|
||||
NS_IMETHOD Move(PRInt32, PRInt32);
|
||||
NS_IMETHOD Resize(PRInt32, PRInt32, PRBool);
|
||||
NS_IMETHOD Resize(PRInt32, PRInt32, PRInt32, PRInt32, PRBool);
|
||||
NS_IMETHOD Enable(PRBool);
|
||||
NS_IMETHOD IsEnabled(PRBool*);
|
||||
NS_IMETHOD SetFocus(PRBool araise = PR_FALSE);
|
||||
|
||||
virtual nsIFontMetrics* GetFont();
|
||||
|
||||
NS_IMETHOD SetFont(const nsFont&);
|
||||
NS_IMETHOD Invalidate(PRBool);
|
||||
NS_IMETHOD Invalidate(const nsRect&, int);
|
||||
NS_IMETHOD Update();
|
||||
NS_IMETHOD SetColorMap(nsColorMap*);
|
||||
NS_IMETHOD Scroll(PRInt32, PRInt32, nsRect*);
|
||||
NS_IMETHOD ScrollWidgets(PRInt32 aDx, PRInt32 aDy);
|
||||
|
||||
NS_IMETHOD SetModal(PRBool aModal);
|
||||
|
||||
virtual void* GetNativeData(PRUint32);
|
||||
|
||||
NS_IMETHOD SetTitle(const nsAString&);
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar*);
|
||||
NS_IMETHOD ShowMenuBar(PRBool);
|
||||
NS_IMETHOD GetScreenBounds(nsRect &aRect);
|
||||
NS_IMETHOD WidgetToScreen(const nsRect&, nsRect&);
|
||||
NS_IMETHOD ScreenToWidget(const nsRect&, nsRect&);
|
||||
NS_IMETHOD BeginResizingChildren();
|
||||
NS_IMETHOD EndResizingChildren();
|
||||
NS_IMETHOD GetPreferredSize(PRInt32&, PRInt32&);
|
||||
NS_IMETHOD SetPreferredSize(PRInt32, PRInt32);
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent*, nsEventStatus&);
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener*, PRBool, PRBool);
|
||||
|
||||
// nsIWidget
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData);
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData);
|
||||
|
||||
nsCursor GetCursor();
|
||||
NS_METHOD SetCursor(nsCursor aCursor);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Event handlers (proxied from the actual qwidget).
|
||||
* They follow normal Qt widget semantics.
|
||||
*/
|
||||
friend class nsQtEventDispatcher;
|
||||
friend class InterceptContainer;
|
||||
friend class MozQWidget;
|
||||
|
||||
virtual bool mousePressEvent(QMouseEvent *);
|
||||
virtual bool mouseReleaseEvent(QMouseEvent *);
|
||||
virtual bool mouseDoubleClickEvent(QMouseEvent *);
|
||||
virtual bool mouseMoveEvent(QMouseEvent *);
|
||||
virtual bool wheelEvent(QWheelEvent *);
|
||||
virtual bool keyPressEvent(QKeyEvent *);
|
||||
virtual bool keyReleaseEvent(QKeyEvent *);
|
||||
virtual bool focusInEvent(QFocusEvent *);
|
||||
virtual bool focusOutEvent(QFocusEvent *);
|
||||
virtual bool enterEvent(QEvent *);
|
||||
virtual bool leaveEvent(QEvent *);
|
||||
virtual bool paintEvent(QPaintEvent *);
|
||||
virtual bool moveEvent(QMoveEvent *);
|
||||
virtual bool resizeEvent(QResizeEvent *);
|
||||
virtual bool closeEvent(QCloseEvent *);
|
||||
virtual bool contextMenuEvent(QContextMenuEvent *);
|
||||
virtual bool imStartEvent(QIMEvent *);
|
||||
virtual bool imComposeEvent(QIMEvent *);
|
||||
virtual bool imEndEvent(QIMEvent *);
|
||||
virtual bool dragEnterEvent(QDragEnterEvent *);
|
||||
virtual bool dragMoveEvent(QDragMoveEvent *);
|
||||
virtual bool dragLeaveEvent(QDragLeaveEvent *);
|
||||
virtual bool dropEvent(QDropEvent *);
|
||||
virtual bool showEvent(QShowEvent *);
|
||||
virtual bool hideEvent(QHideEvent *);
|
||||
|
||||
protected:
|
||||
virtual QWidget *createQWidget(QWidget *parent, nsWidgetInitData *aInitData) = 0;
|
||||
virtual void NativeResize(PRInt32, PRInt32, PRInt32, PRInt32, PRBool);
|
||||
virtual void NativeResize(PRInt32, PRInt32, PRBool);
|
||||
virtual void NativeShow(PRBool);
|
||||
|
||||
bool ignoreEvent(nsEventStatus aStatus) const;
|
||||
|
||||
/**
|
||||
* Has to be called in subclasses after they created
|
||||
* the actual QWidget if they overwrite the Create
|
||||
* calls from the nsCommonWidget class.
|
||||
*/
|
||||
void Initialize(QWidget *widget);
|
||||
|
||||
void DispatchGotFocusEvent(void);
|
||||
void DispatchLostFocusEvent(void);
|
||||
void DispatchActivateEvent(void);
|
||||
void DispatchDeactivateEvent(void);
|
||||
void DispatchResizeEvent(nsRect &aRect, nsEventStatus &aStatus);
|
||||
|
||||
void InitKeyEvent(nsKeyEvent *nsEvent, QKeyEvent *qEvent);
|
||||
void InitMouseEvent(nsMouseEvent *nsEvent, QMouseEvent *qEvent, int aClickCount);
|
||||
void InitMouseWheelEvent(nsMouseScrollEvent *aEvent, QWheelEvent *qEvent);
|
||||
|
||||
void CommonCreate(nsIWidget *aParent, PRBool aListenForResizes);
|
||||
|
||||
PRBool AreBoundsSane() const;
|
||||
|
||||
protected:
|
||||
QWidget *mContainer;
|
||||
QWidget *mWidget;
|
||||
PRPackedBool mListenForResizes;
|
||||
PRPackedBool mNeedsResize;
|
||||
PRPackedBool mNeedsShow;
|
||||
PRPackedBool mIsShown;
|
||||
nsCOMPtr<nsIWidget> mParent;
|
||||
|
||||
private:
|
||||
nsresult NativeCreate(nsIWidget *aParent,
|
||||
QWidget *aNativeParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1069,28 +1069,6 @@ LPARAM nsWindow::lParamToClient(LPARAM lParam)
|
|||
return MAKELPARAM(pt.x, pt.y);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Convert nsEventStatus value to a windows boolean
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
PRBool nsWindow::ConvertStatus(nsEventStatus aStatus)
|
||||
{
|
||||
switch (aStatus) {
|
||||
case nsEventStatus_eIgnore:
|
||||
return PR_FALSE;
|
||||
case nsEventStatus_eConsumeNoDefault:
|
||||
return PR_TRUE;
|
||||
case nsEventStatus_eConsumeDoDefault:
|
||||
return PR_FALSE;
|
||||
default:
|
||||
NS_ASSERTION(0, "Illegal nsEventStatus enumeration value");
|
||||
break;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Initialize an event to dispatch
|
||||
|
|
|
@ -336,7 +336,9 @@ protected:
|
|||
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
static LRESULT CALLBACK DefaultWindowProc(HWND hWns, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
static PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
// Convert nsEventStatus value to a windows boolean
|
||||
static PRBool ConvertStatus(nsEventStatus aStatus)
|
||||
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
|
||||
|
||||
PRBool DispatchStandardEvent(PRUint32 aMsg);
|
||||
PRBool DispatchAppCommandEvent(PRUint32 aEventCommand);
|
||||
|
|
|
@ -1235,22 +1235,6 @@ NS_IMETHODIMP nsWidget::DispatchEvent(nsGUIEvent * aEvent,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsWidget::ConvertStatus(nsEventStatus aStatus)
|
||||
{
|
||||
switch(aStatus) {
|
||||
case nsEventStatus_eIgnore:
|
||||
return(PR_FALSE);
|
||||
case nsEventStatus_eConsumeNoDefault:
|
||||
return(PR_TRUE);
|
||||
case nsEventStatus_eConsumeDoDefault:
|
||||
return(PR_FALSE);
|
||||
default:
|
||||
NS_WARNING("Illegal nsEventStatus enumeration value\n");
|
||||
break;
|
||||
}
|
||||
return(PR_FALSE);
|
||||
}
|
||||
|
||||
void nsWidget::WidgetPut(nsWidget *aWidget)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,256 +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):
|
||||
* Ken Faulkner <faulkner@igelaus.com.au>
|
||||
* Quy Tonthat <quy@igelaus.com.au>
|
||||
* B.J. Rossiter <bj@igelaus.com.au>
|
||||
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
*
|
||||
* 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 nsWidget_h__
|
||||
#define nsWidget_h__
|
||||
|
||||
#include "nsBaseWidget.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "prlog.h"
|
||||
#include "nsIRegion.h"
|
||||
#include "nsIRollupListener.h"
|
||||
#include "xlibrgb.h"
|
||||
|
||||
#ifdef DEBUG_blizzard
|
||||
#define XLIB_WIDGET_NOISY
|
||||
#endif
|
||||
|
||||
class nsWidget : public nsBaseWidget, public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
nsWidget();
|
||||
virtual ~nsWidget();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
|
||||
virtual nsresult StandardWidgetCreate(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData,
|
||||
nsNativeWidget aNativeParent = nsnull);
|
||||
NS_IMETHOD Destroy();
|
||||
virtual nsIWidget *GetParent(void);
|
||||
NS_IMETHOD Show(PRBool bState);
|
||||
NS_IMETHOD IsVisible(PRBool &aState);
|
||||
|
||||
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 Enable(PRBool aState);
|
||||
NS_IMETHOD IsEnabled(PRBool *aState);
|
||||
NS_IMETHOD SetFocus(PRBool aRaise = PR_FALSE);
|
||||
NS_IMETHOD SetName(const char * aName);
|
||||
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
||||
virtual nsIFontMetrics* GetFont(void);
|
||||
NS_IMETHOD SetFont(const nsFont &aFont);
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||
void LockCursor(PRBool aLock);
|
||||
|
||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
|
||||
NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous);
|
||||
NS_IMETHOD Update();
|
||||
virtual void* GetNativeData(PRUint32 aDataType);
|
||||
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
|
||||
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow);
|
||||
NS_IMETHOD SetTooltips(PRUint32 aNumberOfTips,nsRect* aTooltipAreas[]);
|
||||
NS_IMETHOD RemoveTooltips();
|
||||
NS_IMETHOD UpdateTooltips(nsRect* aNewTips[]);
|
||||
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);
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
||||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData);
|
||||
NS_IMETHOD SetBounds(const nsRect &aRect);
|
||||
NS_IMETHOD GetRequestedBounds(nsRect &aRect);
|
||||
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);
|
||||
NS_IMETHOD SetTitle(const nsAString& title);
|
||||
#ifdef DEBUG
|
||||
void DebugPrintEvent(nsGUIEvent & aEvent,Window aWindow);
|
||||
#endif
|
||||
|
||||
virtual PRBool OnPaint(nsPaintEvent &event);
|
||||
virtual PRBool OnResize(nsSizeEvent &event);
|
||||
virtual PRBool OnDeleteWindow(void);
|
||||
|
||||
// KenF Added FIXME:
|
||||
virtual void OnDestroy(void);
|
||||
virtual PRBool DispatchMouseEvent(nsMouseEvent &aEvent);
|
||||
virtual PRBool DispatchKeyEvent(nsKeyEvent &aKeyEvent);
|
||||
virtual PRBool DispatchDestroyEvent(void);
|
||||
|
||||
static nsWidget * GetWidgetForWindow(Window aWindow);
|
||||
void SetVisibility(int aState); // using the X constants here
|
||||
void SetIonic(PRBool isIonic);
|
||||
static Window GetFocusWindow(void);
|
||||
|
||||
Cursor XlibCreateCursor(nsCursor aCursorType);
|
||||
|
||||
PRBool DispatchWindowEvent(nsGUIEvent & aEvent);
|
||||
|
||||
// these are for the wm protocols
|
||||
static Atom WMDeleteWindow;
|
||||
static Atom WMTakeFocus;
|
||||
static Atom WMSaveYourself;
|
||||
static PRBool WMProtocolsInitialized;
|
||||
|
||||
// Checks if parent is alive. nsWidget has a stub, nsWindow has real
|
||||
// thing. KenF
|
||||
void *CheckParent(long ThisWindow);
|
||||
|
||||
// Deal with rollup for popups
|
||||
PRBool IsMouseInWindow(Window window, PRInt32 inMouseX, PRInt32 inMouseY);
|
||||
PRBool HandlePopup( PRInt32 inMouseX, PRInt32 inMouseY);
|
||||
|
||||
void WidgetShow (nsWidget *aWidget);
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIRegion> mUpdateArea;
|
||||
// private event functions
|
||||
PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
|
||||
// create the native window for this class
|
||||
virtual void CreateNativeWindow(Window aParent, nsRect aRect,
|
||||
XSetWindowAttributes aAttr, unsigned long aMask);
|
||||
virtual void CreateNative(Window aParent, nsRect aRect);
|
||||
virtual void DestroyNative();
|
||||
static void DestroyNativeChildren(Display *aDisplay, Window aWindow);
|
||||
void Map(void);
|
||||
void Unmap(void);
|
||||
|
||||
// Let each sublclass set the event mask according to their needs
|
||||
virtual long GetEventMask();
|
||||
|
||||
// these will add and delete a window
|
||||
static void AddWindowCallback (Window aWindow, nsWidget *aWidget);
|
||||
static void DeleteWindowCallback(Window aWindow);
|
||||
|
||||
// set up our wm hints
|
||||
void SetUpWMHints(void);
|
||||
|
||||
// here's how we add children
|
||||
// there's no geometry information here because that should be in the mBounds
|
||||
// in the widget
|
||||
void WidgetPut (nsWidget *aWidget);
|
||||
void WidgetMove (nsWidget *aWidget);
|
||||
void WidgetMoveResize (nsWidget *aWidget);
|
||||
void WidgetResize (nsWidget *aWidget);
|
||||
// check to see whether or not a rect will intersect with the current scrolled area
|
||||
PRBool WidgetVisible (nsRect &aBounds);
|
||||
|
||||
PRBool mIsShown;
|
||||
int mVisibility; // this is an int because that's the way X likes it
|
||||
PRUint32 mPreferredWidth;
|
||||
PRUint32 mPreferredHeight;
|
||||
|
||||
nsIWidget * mParentWidget;
|
||||
Window mParentWindow;
|
||||
|
||||
// All widgets have at least these items.
|
||||
XlibRgbHandle *mXlibRgbHandle;
|
||||
Display * mDisplay;
|
||||
Screen * mScreen;
|
||||
Window mBaseWindow;
|
||||
Visual * mVisual;
|
||||
int mDepth;
|
||||
unsigned long mBackgroundPixel;
|
||||
PRUint32 mBorderRGB;
|
||||
unsigned long mBorderPixel;
|
||||
nsString mName; // name of the type of widget
|
||||
nsRect mRequestedSize;
|
||||
PRPackedBool mIsToplevel;
|
||||
PRPackedBool mMapped;
|
||||
PRPackedBool mLastGrabFailed;
|
||||
|
||||
static Window mFocusWindow;
|
||||
|
||||
// Changed to protected so nsWindow has access to it. KenF
|
||||
protected:
|
||||
PRBool mListenForResizes; // If we're native we want to listen.
|
||||
static nsHashtable * gsWindowList;
|
||||
static Cursor gsXlibCursorCache[eCursorCount];
|
||||
|
||||
// Variables for infomation about the current popup window and its listener
|
||||
static nsCOMPtr<nsIRollupListener> gRollupListener;
|
||||
static nsWeakPtr gRollupWidget;
|
||||
static PRBool gRollupConsumeRollupEvent;
|
||||
};
|
||||
|
||||
extern PRLogModuleInfo *XlibWidgetsLM;
|
||||
extern PRLogModuleInfo *XlibScrollingLM;
|
||||
|
||||
#endif /* !nsWidget_h__ */
|
||||
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче