This commit is contained in:
spider 1998-05-20 23:18:09 +00:00
Родитель f68c4a84eb
Коммит d0e6480337
5 изменённых файлов: 58 добавлений и 35 удалений

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

@ -27,7 +27,7 @@ REQUIRES=util img xpcom raptor netlib
DEFINES = -D_IMPL_NS_WIDGET DEFINES = -D_IMPL_NS_WIDGET
LLIBS+=$(DIST)/lib/libxpcom.a $(DIST)/lib/libraptorbase.a $(DIST)/lib/libraptorgfx.a -lXm -lXt -lX11 EXTRA_DSO_LDOPTS+=$(DIST)/lib/libxpcom.a $(DIST)/lib/libraptorbase.a $(DIST)/lib/libraptorgfx.a -lXm -lXt -lX11
CPPSRCS=nsWidgetFactory.cpp \ CPPSRCS=nsWidgetFactory.cpp \
nsWindow.cpp \ nsWindow.cpp \

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

@ -55,8 +55,7 @@ void nsWindow::ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect)
// Setup initial tooltip rectangles // Setup initial tooltip rectangles
// //
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
void nsWindow::SetTooltips(PRUint32 aNumberOfTips,nsRect* aTooltipAreas[])
void nsWindow::SetTooltips(PRUint32 aNumberOfTips,const nsRect* aTooltipAreas)
{ {
} }
@ -66,7 +65,7 @@ void nsWindow::SetTooltips(PRUint32 aNumberOfTips,const nsRect* aTooltipAreas)
// //
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
void nsWindow::UpdateTooltips(const nsRect* aNewTips) void nsWindow::UpdateTooltips(nsRect* aNewTips[])
{ {
} }
@ -91,6 +90,9 @@ nsWindow::nsWindow(nsISupports *aOuter)
// XXX Til can deal with ColorMaps! // XXX Til can deal with ColorMaps!
SetForegroundColor(1); SetForegroundColor(1);
SetBackgroundColor(2); SetBackgroundColor(2);
mToolkit = nsnull ;
} }
@ -115,7 +117,7 @@ void nsWindow::Create(nsIWidget *aParent,
EVENT_CALLBACK aHandleEventFunction, EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext, nsIDeviceContext *aContext,
nsIToolkit *aToolkit, nsIToolkit *aToolkit,
void *aInitData) nsWidgetInitData *aInitData)
{ {
Widget mainWindow, frame; Widget mainWindow, frame;
@ -152,6 +154,22 @@ void nsWindow::Create(nsIWidget *aParent,
else { else {
nsresult res; nsresult res;
// XXX Move this! - For some reason Registering in another DLL (shell) isn't working
#define GFXWIN_DLL "libgfxunix.so"
static NS_DEFINE_IID(kCRenderingContextIID, NS_RENDERING_CONTEXT_CID);
static NS_DEFINE_IID(kCDeviceContextIID, NS_DEVICE_CONTEXT_CID);
static NS_DEFINE_IID(kCFontMetricsIID, NS_FONT_METRICS_CID);
static NS_DEFINE_IID(kCImageIID, NS_IMAGE_CID);
NSRepository::RegisterFactory(kCRenderingContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
NSRepository::RegisterFactory(kCDeviceContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
NSRepository::RegisterFactory(kCFontMetricsIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
NSRepository::RegisterFactory(kCImageIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID); static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID); static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
@ -163,20 +181,20 @@ void nsWindow::Create(nsIWidget *aParent,
if (NS_OK == res) if (NS_OK == res)
mContext->Init(); mContext->Init();
} }
if (aParent) if (aParent)
parentWidget = (Widget) aParent->GetNativeData(NS_NATIVE_WIDGET); parentWidget = (Widget) aParent->GetNativeData(NS_NATIVE_WIDGET);
else else
parentWidget = (Widget) aInitData ; parentWidget = (Widget) aInitData ;
if (!aParent) if (!aParent)
mainWindow = ::XtVaCreateManagedWidget("mainWindow", mainWindow = ::XtVaCreateManagedWidget("mainWindow",
xmMainWindowWidgetClass, xmMainWindowWidgetClass,
parentWidget, parentWidget,
XmNwidth, aRect.width, XmNwidth, aRect.width,
XmNheight, aRect.height, XmNheight, aRect.height,
nsnull); nsnull);
frame = ::XtVaCreateManagedWidget("frame", frame = ::XtVaCreateManagedWidget("frame",
xmDrawingAreaWidgetClass, xmDrawingAreaWidgetClass,
(aParent) ? parentWidget : mainWindow, (aParent) ? parentWidget : mainWindow,
@ -236,7 +254,7 @@ void nsWindow::Create(nsNativeWindow aParent,
EVENT_CALLBACK aHandleEventFunction, EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext, nsIDeviceContext *aContext,
nsIToolkit *aToolkit, nsIToolkit *aToolkit,
void *aInitData) nsWidgetInitData *aInitData)
{ {
} }
@ -488,11 +506,6 @@ void* nsWindow::GetNativeData(PRUint32 aDataType)
return (void*)(mWidget); return (void*)(mWidget);
} }
break; break;
case NS_NATIVE_DISPLAY:
{
return (void*)(XtDisplay(mWidget));
}
break;
case NS_NATIVE_GRAPHIC: case NS_NATIVE_GRAPHIC:
{ {
XGCValues values; XGCValues values;
@ -670,6 +683,13 @@ void nsWindow::OnPaint(nsPaintEvent &event)
} }
void nsWindow::BeginResizingChildren(void)
{
}
void nsWindow::EndResizingChildren(void)
{
}

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

@ -52,13 +52,13 @@ public:
EVENT_CALLBACK aHandleEventFunction, EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext, nsIDeviceContext *aContext,
nsIToolkit *aToolkit = nsnull, nsIToolkit *aToolkit = nsnull,
void *aInitData = nsnull); nsWidgetInitData *aInitData = nsnull);
virtual void Create(nsNativeWindow aParent, virtual void Create(nsNativeWindow aParent,
const nsRect &aRect, const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction, EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext, nsIDeviceContext *aContext,
nsIToolkit *aToolkit = nsnull, nsIToolkit *aToolkit = nsnull,
void *aInitData = nsnull); nsWidgetInitData *aInitData = nsnull);
virtual void Destroy(); virtual void Destroy();
virtual nsIWidget* GetParent(void); virtual nsIWidget* GetParent(void);
virtual nsIEnumerator* GetChildren(); virtual nsIEnumerator* GetChildren();
@ -92,9 +92,10 @@ public:
virtual nsIToolkit* GetToolkit(); virtual nsIToolkit* GetToolkit();
virtual void SetBorderStyle(nsBorderStyle aBorderStyle); virtual void SetBorderStyle(nsBorderStyle aBorderStyle);
virtual void SetTitle(const nsString& aTitle); virtual void SetTitle(const nsString& aTitle);
virtual void SetTooltips(PRUint32 aNumberOfTips,const nsRect* aTooltipAreas); virtual void SetTooltips(PRUint32 aNumberOfTips,nsRect* aTooltipAreas[]);
virtual void RemoveTooltips(); virtual void RemoveTooltips();
virtual void UpdateTooltips(const nsRect* aNewTips); virtual void UpdateTooltips(nsRect* aNewTips[]);
virtual void WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect); virtual void WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect);
virtual void ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect); virtual void ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect);
virtual void AddMouseListener(nsIMouseListener * aListener); virtual void AddMouseListener(nsIMouseListener * aListener);
@ -103,9 +104,11 @@ public:
PRBool DispatchEvent(nsGUIEvent* event); PRBool DispatchEvent(nsGUIEvent* event);
static PRBool ConvertStatus(nsEventStatus aStatus); static PRBool ConvertStatus(nsEventStatus aStatus);
virtual void BeginResizingChildren(void);
virtual void EndResizingChildren(void);
private: private:
Widget mWidget; Widget mWidget;
GC mGC ;
EVENT_CALLBACK mEventCallback; EVENT_CALLBACK mEventCallback;
nsIDeviceContext *mContext; nsIDeviceContext *mContext;
nsIFontMetrics *mFontMetrics; nsIFontMetrics *mFontMetrics;

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

@ -23,10 +23,10 @@
#include "stdio.h" #include "stdio.h"
void nsXtWidget_ExposureMask_EventHandler(Widget w, caddr_t client_data, XEvent * event) void nsXtWidget_ExposureMask_EventHandler(Widget w, XtPointer p, XEvent * event, Boolean * b)
{ {
nsPaintEvent pevent ; nsPaintEvent pevent ;
nsWindow * widgetWindow = (nsWindow *) client_data ; nsWindow * widgetWindow = (nsWindow *) p ;
if (event->xexpose.count != 0) if (event->xexpose.count != 0)
return ; return ;
@ -43,19 +43,19 @@ void nsXtWidget_ExposureMask_EventHandler(Widget w, caddr_t client_data, XEvent
} }
void nsXtWidget_ButtonPressMask_EventHandler(Widget w, caddr_t client_data, XEvent * event) void nsXtWidget_ButtonPressMask_EventHandler(Widget w, XtPointer p, XEvent * event, Boolean * b)
{ {
nsWindow * widgetWindow = (nsWindow *) client_data ; nsWindow * widgetWindow = (nsWindow *) p;
} }
void nsXtWidget_ButtonReleaseMask_EventHandler(Widget w, caddr_t client_data, XEvent * event) void nsXtWidget_ButtonReleaseMask_EventHandler(Widget w, XtPointer p, XEvent * event, Boolean * b)
{ {
nsWindow * widgetWindow = (nsWindow *) client_data ; nsWindow * widgetWindow = (nsWindow *) p ;
} }
void nsXtWidget_ButtonMotionMask_EventHandler(Widget w, caddr_t client_data, XEvent * event) void nsXtWidget_ButtonMotionMask_EventHandler(Widget w, XtPointer p, XEvent * event, Boolean * b)
{ {
nsWindow * widgetWindow = (nsWindow *) client_data ; nsWindow * widgetWindow = (nsWindow *) p ;
} }

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

@ -21,10 +21,10 @@
#include "Xm/Xm.h" #include "Xm/Xm.h"
void nsXtWidget_ExposureMask_EventHandler(Widget w, caddr_t client_data, XEvent * event); void nsXtWidget_ExposureMask_EventHandler(Widget w, XtPointer p, XEvent * event, Boolean * b);
void nsXtWidget_ButtonPressMask_EventHandler(Widget w, caddr_t client_data, XEvent * event); void nsXtWidget_ButtonPressMask_EventHandler(Widget w,XtPointer p, XEvent * event, Boolean * b);
void nsXtWidget_ButtonReleaseMask_EventHandler(Widget w, caddr_t client_data, XEvent * event); void nsXtWidget_ButtonReleaseMask_EventHandler(Widget w, XtPointer p, XEvent * event, Boolean * b);
void nsXtWidget_ButtonMotionMask_EventHandler(Widget w, caddr_t client_data, XEvent * event); void nsXtWidget_ButtonMotionMask_EventHandler(Widget w, XtPointer p, XEvent * event, Boolean * b);
#endif // __nsXtEventHandler.h #endif // __nsXtEventHandler.h