Bug 178987 Get qt toolkit working again

patch by esben@despammed.com r=timeless rs=bz a=roc
some changes by me
Bug 184257 Infrequent nsIPref users need to be converted to nsIPrefService, etc.
patch by caillon@returnzero.com r=timeless rs=bz a=roc
This commit is contained in:
timeless%mozdev.org 2002-12-10 07:34:13 +00:00
Родитель 8d7ea68681
Коммит 2a124528f5
9 изменённых файлов: 32 добавлений и 545 удалений

Просмотреть файл

@ -73,6 +73,7 @@ CFLAGS += $(MOZ_QT_CFLAGS)
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) \ EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) \
-lgkgfx \ -lgkgfx \
-lgfxshared_s \
$(MOZ_JS_LIBS) \ $(MOZ_JS_LIBS) \
$(NULL) $(NULL)

Просмотреть файл

@ -69,14 +69,14 @@ NS_IMPL_ISUPPORTS1(nsClipboard, nsIClipboard);
// nsClipboard constructor // nsClipboard constructor
// //
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
nsClipboard::nsClipboard() nsClipboard::nsClipboard() :
mSelectionOwner (nsnull),
mGlobalOwner (nsnull),
mSelectionTransferable (nsnull),
mGlobalTransferable (nsnull),
mIgnoreEmptyNotification (PR_FALSE)
{ {
NS_INIT_ISUPPORTS(); NS_INIT_ISUPPORTS();
mIgnoreEmptyNotification = PR_FALSE;
mGlobalTransferable = nsnull;
mSelectionTransferable = nsnull;
mGlobalOwner = nsnull;
mSelectionOwner = nsnull;
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
@ -88,6 +88,14 @@ nsClipboard::~nsClipboard()
{ {
} }
#ifdef DEBUG_timeless
// XXX nsBaseClipboard will have an init method to allow for constructors to fail
NS_IMETHODIMP nsClipboard::Init()
{
return NS_OK;
}
#endif
NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard) NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard)
{ {
mIgnoreEmptyNotification = PR_TRUE; mIgnoreEmptyNotification = PR_TRUE;

Просмотреть файл

@ -1,78 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* 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):
* Denis Issoupov <denis@macadamian.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
* 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsClipboard_h__
#define nsClipboard_h__
#include "nsIClipboard.h"
#include "nsITransferable.h"
#include "nsIClipboardOwner.h"
#include "nsCOMPtr.h"
#include <qlist.h>
#include <qcstring.h>
#include <qmime.h>
/* Native QT Clipboard wrapper */
class nsClipboard : public nsIClipboard
{
public:
nsClipboard();
virtual ~nsClipboard();
//nsISupports
NS_DECL_ISUPPORTS
// nsIClipboard
NS_DECL_NSICLIPBOARD
protected:
NS_IMETHOD SetNativeClipboardData(PRInt32 aWhichClipboard);
NS_IMETHOD GetNativeClipboardData(nsITransferable *aTransferable,
PRInt32 aWhichClipboard);
inline nsITransferable *GetTransferable(PRInt32 aWhichClipboard);
PRBool mIgnoreEmptyNotification;
nsCOMPtr<nsIClipboardOwner> mSelectionOwner;
nsCOMPtr<nsIClipboardOwner> mGlobalOwner;
nsCOMPtr<nsITransferable> mSelectionTransferable;
nsCOMPtr<nsITransferable> mGlobalTransferable;
};
#endif // nsClipboard_h__

Просмотреть файл

@ -1,173 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* 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):
* Denis Issoupov <denis@macadamian.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
* 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsDragService.h"
#include "nsIServiceManager.h"
#include "nsWidget.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsXPIDLString.h"
#include "nsPrimitiveHelpers.h"
#include "nsReadableUtils.h"
#include "nsClipboard.h"
#include "nsMime.h"
#include <qapplication.h>
#include <qclipboard.h>
//----------------------------------------------------------
nsMimeStoreData::nsMimeStoreData(QCString& name, QByteArray& data)
{
flavorName = name;
flavorData = data;
}
nsMimeStoreData::nsMimeStoreData(const char* name,void* rawdata,PRInt32 rawlen)
{
flavorName = name;
flavorData.assign((char*)rawdata,(unsigned int)rawlen);
}
//----------------------------------------------------------
nsMimeStore::nsMimeStore()
{
mMimeStore.setAutoDelete(TRUE);
}
nsMimeStore::~nsMimeStore()
{
}
const char* nsMimeStore::format(int n) const
{
if (n >= (int)mMimeStore.count())
return 0;
// because of const
QList<nsMimeStoreData> *pMimeStore = (QList<nsMimeStoreData>*)&mMimeStore;
nsMimeStoreData* msd;
msd = pMimeStore->at((unsigned int)n);
return msd->flavorName;
}
QByteArray nsMimeStore::encodedData(const char* name) const
{
QByteArray qba;
// because of const
QList<nsMimeStoreData> *pMimeStore = (QList<nsMimeStoreData>*)&mMimeStore;
nsMimeStoreData* msd;
for (msd = pMimeStore->first(); msd != 0; msd = pMimeStore->next()) {
if (strcmp(name, msd->flavorName) == 0) {
qba = msd->flavorData;
return qba;
}
}
#ifdef NS_DEBUG
printf("nsMimeStore::encodedData requested unknown %s\n", name);
#endif
return qba;
}
PRBool nsMimeStore::ContainsFlavor(const char* name)
{
for (nsMimeStoreData *msd = mMimeStore.first(); msd; msd = mMimeStore.next()) {
if (!strcmp(name, msd->flavorName))
return PR_TRUE;
}
return PR_FALSE;
}
PRBool nsMimeStore::AddFlavorData(const char* name, void* data, PRInt32 len)
{
if (ContainsFlavor(name))
return PR_FALSE;
mMimeStore.append(new nsMimeStoreData(name, data, len));
// we're done unless we're given text/unicode,
// and text/plain is not already advertised,
if (strcmp(name, kUnicodeMime) || ContainsFlavor(kTextMime))
return PR_TRUE;
// in which case we also advertise text/plain
// which we will convert on our own in nsDataObj::GetText().
char *as = ToNewCString(nsDependentString((PRUnichar*)data));
// let's text/plain be first for stupid programs
// Ownership of |as| is transfered to mMimeStore
mMimeStore.insert(0,new nsMimeStoreData(kTextMime,as,nsCRT::strlen(as) + 1));
return PR_TRUE;
}
//----------------------------------------------------------
nsDragObject::nsDragObject(nsMimeStore* mimeStore,QWidget* dragSource,
const char* name)
: QDragObject(dragSource, name)
{
if (!mimeStore)
NS_ASSERTION(PR_TRUE, "Invalid pointer.");
mMimeStore = mimeStore;
}
nsDragObject::~nsDragObject()
{
delete mMimeStore;
}
const char* nsDragObject::format(int i) const
{
if (i >= (int)mMimeStore->count())
return 0;
const char* frm = mMimeStore->format(i);
#ifdef NS_DEBUG
printf("nsDragObject::format i=%i %s\n",i, frm);
#endif
return frm;
}
QByteArray nsDragObject::encodedData(const char* frm) const
{
#ifdef NS_DEBUG
printf("nsDragObject::encodedData %s\n",frm);
#endif
return mMimeStore->encodedData(frm);
}

Просмотреть файл

@ -86,16 +86,19 @@ int _x_error(Display *display, XErrorEvent *error)
nsQApplication* nsQApplication::Instance(int argc,char** argv) nsQApplication* nsQApplication::Instance(int argc,char** argv)
{ {
printf("Enter nsQApplication::Instance\n");
if (!mInstance) if (!mInstance)
mInstance = new nsQApplication(argc,argv); mInstance = new nsQApplication(argc,argv);
mRefCnt++; mRefCnt++;
printf("Exit nsQApplication::Instance\n");
return mInstance; return mInstance;
} }
void nsQApplication::Release() void nsQApplication::Release()
{ {
printf("Enter nsQApplication::Release\n");
mRefCnt--; mRefCnt--;
if (mRefCnt <= 0) { if (mRefCnt <= 0) {
if (mMasterWidget) { if (mMasterWidget) {
@ -105,19 +108,23 @@ void nsQApplication::Release()
delete mInstance; delete mInstance;
mInstance = nsnull; mInstance = nsnull;
} }
printf("Exit nsQApplication::Release\n");
} }
QWidget *nsQApplication::GetMasterWidget() QWidget *nsQApplication::GetMasterWidget()
{ {
printf("Enter nsQApplication::GetMasterWidget\n");
if (!mMasterWidget) if (!mMasterWidget)
mMasterWidget = new QWidget(); mMasterWidget = new QWidget();
printf("Exit nsQApplication::GetMasterWidget\n");
return mMasterWidget; return mMasterWidget;
} }
nsQApplication::nsQApplication(int argc,char** argv) nsQApplication::nsQApplication(int argc,char** argv)
: QApplication(argc,argv) : QApplication(argc,argv)
{ {
printf("Enter: QApplication::QApplication\n");
#ifdef DBG_JCG #ifdef DBG_JCG
gQAppCount++; gQAppCount++;
mID = gQAppID++; mID = gQAppID++;
@ -125,23 +132,24 @@ nsQApplication::nsQApplication(int argc,char** argv)
XSetErrorHandler (_x_error); XSetErrorHandler (_x_error);
#endif #endif
if (mInstance) NS_ASSERTION(!mInstance, "Attempt to create duplicate QApplication Object.");
NS_ASSERTION(mInstance == nsnull,
"Attempt to create duplicate QApplication Object.");
mInstance = this; mInstance = this;
setGlobalMouseTracking(true); setGlobalMouseTracking(true);
setStyle(new QWindowsStyle); setStyle(new QWindowsStyle);
setOverrideCursor(QCursor(ArrowCursor),PR_TRUE); setOverrideCursor(QCursor(ArrowCursor),PR_TRUE);
connect(this,SIGNAL(lastWindowClosed()),this,SLOT(quit())); connect(this,SIGNAL(lastWindowClosed()),this,SLOT(quit()));
printf("Exit: QApplication::QApplication\n");
} }
nsQApplication::~nsQApplication() nsQApplication::~nsQApplication()
{ {
printf("Enter: QApplication::~QApplication\n");
#ifdef DBG_JCG #ifdef DBG_JCG
gQAppCount--; gQAppCount--;
printf("JCG nsQApplication DTOR (%p) ID: %d, Count: %d\n",this,mID,gQAppCount); printf("JCG nsQApplication DTOR (%p) ID: %d, Count: %d\n",this,mID,gQAppCount);
#endif #endif
setGlobalMouseTracking(false); setGlobalMouseTracking(false);
printf("Exit: QApplication::~QApplication\n");
} }
void nsQApplication::AddEventProcessorCallback(nsIEventQueue* EQueue) void nsQApplication::AddEventProcessorCallback(nsIEventQueue* EQueue)

Просмотреть файл

@ -1,92 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* 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):
* John C. Griggs <johng@corel.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
* 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsQApplication_h__
#define nsQApplication_h__
#include "nsIEventQueue.h"
#include <qapplication.h>
#include <qsocketnotifier.h>
class nsQtEventQueue : public QObject
{
Q_OBJECT
public:
nsQtEventQueue(nsIEventQueue *EQueue);
~nsQtEventQueue();
unsigned long IncRefCnt();
unsigned long DecRefCnt();
public slots:
void DataReceived();
private:
nsIEventQueue *mEventQueue;
QSocketNotifier *mQSocket;
PRUint32 mRefCnt;
PRInt32 mID;
};
class nsQApplication : public QApplication
{
Q_OBJECT
public:
static nsQApplication *Instance(int argc,char **argv);
static void Release();
static void AddEventProcessorCallback(nsIEventQueue *EQueue);
static void RemoveEventProcessorCallback(nsIEventQueue *EQueue);
static QWidget *GetMasterWidget();
///Hook for debugging X11 Events
bool x11EventFilter(XEvent *event);
protected:
nsQApplication(int argc,char **argv);
~nsQApplication();
private:
PRInt32 mID;
static QIntDict<nsQtEventQueue> mQueueDict;
static nsQApplication *mInstance;
static PRUint32 mRefCnt;
static QWidget *mMasterWidget;
};
#endif // nsQApplication_h__

Просмотреть файл

@ -48,6 +48,7 @@
#include "nsQApplication.h" #include "nsQApplication.h"
#include <qobjectlist.h> #include <qobjectlist.h>
#include <qcursor.h>
//JCG #define DBG_JCG 1 //JCG #define DBG_JCG 1
//JCG #define DBG_JCG_EVENT 1 //JCG #define DBG_JCG_EVENT 1
@ -1111,13 +1112,13 @@ void qt_leave_modal(QWidget*); // --- "" ---
void nsQWidget::SetModal(PRBool aState) void nsQWidget::SetModal(PRBool aState)
{ {
if (aState) { if (aState) {
setWFlags(Qt::WType_Modal); setWFlags(Qt::WShowModal);
setWState(Qt::WState_Modal); // setWState(Qt::WState_Modal);
qt_enter_modal(this); qt_enter_modal(this);
} }
else { else {
clearWFlags(Qt::WType_Modal); clearWFlags(Qt::WShowModal);
clearWState(Qt::WState_Modal); // clearWState(Qt::WState_Modal);
qt_leave_modal(this); qt_leave_modal(this);
} }
} }

Просмотреть файл

@ -1,189 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* 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):
* John C. Griggs <jcgriggs@sympatico.ca>
* Denis Issoupov <denis@macadamian.com>
* Wes Morgan <wmorga13@calvin.edu>
*
* 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsQWidget_h__
#define nsQWidget_h__
#include <qwidget.h>
#include <qstring.h>
#include "nsIWidget.h"
class nsFontQT;
class nsWidget;
/* Utility Functions */
PRBool NS_IsMouseInWindow(void *aWin,PRInt32 aMouseX,PRInt32 aMouseY);
unsigned int NS_GetQWFlags(nsBorderStyle aBorder,nsWindowType aType);
//=============================================================================
// nsQWidget class:
// Customizes QWidget for use in XPFE
//=============================================================================
class nsQWidget : public QWidget
{
Q_OBJECT
public:
nsQWidget(QWidget *aParent,const char *aName = 0,WFlags aFlags = WResizeNoErase);
virtual ~nsQWidget();
virtual void SetModal(PRBool aState);
private:
PRUint32 mQWidgetID;
};
//=============================================================================
// nsQBaseWidget class
// Provides a "two-way" interface, allowing XPFE to access Qt Widget
// functionality and hooking the relevant Qt Events into the XPFE Event
// Handling
//=============================================================================
class nsQBaseWidget : public QObject
{
Q_OBJECT
public:
nsQBaseWidget(nsWidget *aWidget);
virtual ~nsQBaseWidget();
/*** Lifecycle Management ***/
PRBool CreateNative(QWidget *aParent = 0,const char *aName = 0,
unsigned int aFlags = WResizeNoErase);
virtual void Destroy();
/*** Interface to Qt Widget functionality for XPFE ***/
void Enable(PRBool aState);
PRBool HandlePopup(void *aEvent);
virtual void SetCursor(nsCursor aCursor);
virtual void SetFont(nsFontQT *aFont);
virtual void SetModal(PRBool aState)
{
((nsQWidget*)mQWidget)->SetModal(aState);
};
virtual const char *Name() {return mQWidget->name();};
virtual int Width() {return mQWidget->width();};
virtual int Height() {return mQWidget->height();};
virtual int BoundsX() {return 0;};
virtual int BoundsY() {return 0;};
virtual void OffsetXYToGlobal(PRInt32 *aX,PRInt32 *aY)
{
QPoint offset(0,0);
offset = mQWidget->mapToGlobal(offset);
*aX = offset.x();
*aY = offset.y();
};
virtual void OffsetXYFromGlobal(PRInt32 *aX,PRInt32 *aY)
{
QPoint offset(0,0);
offset = mQWidget->mapFromGlobal(offset);
*aX = offset.x();
*aY = offset.y();
};
virtual void Move(PRInt32 aX,PRInt32 aY) {mQWidget->move(aX,aY);};
virtual void Resize(PRInt32 aW,PRInt32 aH) {mQWidget->resize(aW,aH);};
virtual void Scroll(PRInt32 aDx,PRInt32 aDy) {mQWidget->scroll(aDx,aDy);};
virtual void Show() {mQWidget->show();};
virtual void Hide() {mQWidget->hide();};
virtual PRBool IsVisible() {return mQWidget->isVisible();};
virtual void SetFocus() {mQWidget->setFocus();};
virtual void SetTopLevelFocus() {mQWidget->topLevelWidget()->setFocus();};
virtual void RaiseTopLevel() {mQWidget->topLevelWidget()->raise();};
virtual PRBool IsTopLevelActive()
{
return(mQWidget->topLevelWidget()->isActiveWindow());
};
virtual void SetTitle(const char *aTitleStr)
{
mQWidget->setCaption(QString::fromLocal8Bit(aTitleStr));
};
virtual void SetBackgroundColor(const nscolor &aColor)
{
QColor color(NS_GET_R(aColor),NS_GET_G(aColor),NS_GET_B(aColor));
mQWidget->setBackgroundColor(color);
};
virtual void Polish() {mQWidget->polish();};
virtual void Repaint(PRBool aErase) {mQWidget->repaint(aErase);};
virtual void Repaint(PRInt32 aX,PRInt32 aY,PRInt32 aW, PRInt32 aH,PRBool aErase)
{
mQWidget->repaint(aX,aY,aW,aH,aErase);
};
virtual void Update() {mQWidget->update();};
virtual void Update(PRInt32 aX,PRInt32 aY,PRInt32 aW, PRInt32 aH)
{
mQWidget->update(aX,aY,aW,aH);
};
virtual void *GetNativeWindow() {return((void*)(QPaintDevice*)mQWidget);};
virtual void *GetNativeWidget() {return((void*)mQWidget);};
virtual void* X11Display() {return (void*)mQWidget->x11Display();};
virtual void* WinID() {return (void*)mQWidget->winId();};
/*** Interface to XPFE Event Handling from Qt ***/
bool eventFilter(QObject *aObj,QEvent *aEvent);
virtual PRBool MouseButtonEvent(QMouseEvent *aEvent,PRBool aButtonDown,
int aClickCount);
virtual PRBool MouseMovedEvent(QMouseEvent *aEvent);
virtual PRBool MouseEnterEvent(QEvent *aEvent);
virtual PRBool MouseExitEvent(QEvent *aEvent);
virtual PRBool MouseWheelEvent(QWheelEvent *aEvent);
virtual PRBool DestroyEvent();
virtual PRBool ResizeEvent(QResizeEvent *aEvent);
virtual PRBool MoveEvent(QMoveEvent *aEvent);
virtual PRBool PaintEvent(QPaintEvent *aEvent);
virtual PRBool KeyPressEvent(QKeyEvent *aEvent);
virtual PRBool KeyReleaseEvent(QKeyEvent *aEvent);
virtual PRBool FocusInEvent();
virtual PRBool FocusOutEvent();
virtual PRBool DragEnterEvent(QDragEnterEvent *aEvent);
virtual PRBool DragMoveEvent(QDragMoveEvent *aEvent);
virtual PRBool DragLeaveEvent(QDragLeaveEvent *aEvent);
virtual PRBool DropEvent(QDropEvent *aEvent);
protected:
nsWidget *mWidget;
QWidget *mQWidget;
PRBool mEnabled;
PRBool mDestroyed;
private:
PRUint32 mQBaseID;
};
#endif //nsQWidget_h__

Просмотреть файл

@ -202,6 +202,7 @@ nsIWidget *nsWidget::GetParent(void)
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
NS_METHOD nsWidget::Show(PRBool bState) NS_METHOD nsWidget::Show(PRBool bState)
{ {
printf("Show. bState=%s, mWidget=%p\n", bState?"true":"false", mWidget);
if (!mWidget) { if (!mWidget) {
return NS_OK; // Will be null during printing return NS_OK; // Will be null during printing
} }