Moved the cross-platform widgets into their own directory.

Moved the platform specific factories into the new "build" directory.
The "build" directory now links the spwidgets and the platforms specific
widgets together.


git-svn-id: svn://10.0.0.236/trunk@12924 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rods%netscape.com 1998-10-15 21:30:32 +00:00
parent 52586c4d17
commit b962ff63b0
23 changed files with 166 additions and 37 deletions

View File

@ -20,7 +20,7 @@ DEPTH=../..
ifeq ($(OS_TARGET),Rhapsody)
DIRS = rhapsody
else
DIRS = motif
DIRS = xpwidgets motif build
endif
include $(DEPTH)/config/config.mk
@ -28,3 +28,4 @@ include $(DEPTH)/config/config.mk
TARGET = $(LIBRARY)
include $(DEPTH)/config/rules.mk

View File

@ -0,0 +1,56 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../..
include $(DEPTH)/config/config.mk
LIBRARY_NAME = widgetunix
MODULE=raptor
REQUIRES=util img xpcom raptor netlib
INCLUDES+= -I../xpwidgets -I../motif -I.
CPPSRCS=dlldeps.cpp nsWidgetSupport.cpp nsMotifWidgetFactory.cpp
ifeq ($(OS_ARCH),IRIX)
LD = $(CCC)
LD_ALL = -all
LD_NONE = -none
endif
EXTRA_DSO_LDOPTS+=\
$(DIST)/lib/libraptorwidgetunix_s.a \
$(DIST)/lib/libraptorbasewidget_s.a \
$(DIST)/bin/libxpcom.so \
$(DIST)/bin/libraptorbase.so \
$(DIST)/bin/libreg.so \
$(LIBNSPR)\
$(DIST)/lib/libplc21.a
# This should really be done properly in 'config'
ifeq ($(OS_ARCH),Linux)
EXTRA_DSO_LDOPTS+=\
-L/usr/X11R6/lib -lX11 -lm
else
EXTRA_DSO_LDOPTS+= -lXm -lXt -lX11 -lm
endif
include $(DEPTH)/config/rules.mk

View File

@ -0,0 +1,29 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// Force references to all of the symbols that we want exported from
// the dll that are located in the .lib files we link with
#include "Xm/Xm.h"
XtAppContext gAppContext;
void XXXNeverCalled()
{
gAppContext = NULL;
}

View File

@ -41,13 +41,13 @@
#include "nsMenu.h"
#include "nsMenuItem.h"
#include "nsPopUpMenu.h"
/* XXX Not checked in yet
#include "nsImageButton.h"
#include "nsMenuButton.h"
#include "nsToolbar.h"
#include "nsToolbarManager.h"
#include "nsToolbarItemHolder.h"
*/
static NS_DEFINE_IID(kCWindow, NS_WINDOW_CID);
@ -80,13 +80,12 @@ static NS_DEFINE_IID(kCMenuBar, NS_MENUBAR_CID);
static NS_DEFINE_IID(kCMenu, NS_MENU_CID);
static NS_DEFINE_IID(kCMenuItem, NS_MENUITEM_CID);
static NS_DEFINE_IID(kCPopUpMenu, NS_POPUPMENU_CID);
/* XXX Not checked in yet
static NS_DEFINE_IID(kCImageButton, NS_IMAGEBUTTON_CID);
static NS_DEFINE_IID(kCToolBar, NS_TOOLBAR_CID);
static NS_DEFINE_IID(kCToolBarManager, NS_TOOLBARMANAGER_CID);
static NS_DEFINE_IID(kCToolBarItemHolder, NS_TOOLBARITEMHOLDER_CID);
static NS_DEFINE_IID(kCMenuButton, NS_MENUBUTTON_CID);
*/
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
@ -216,8 +215,8 @@ nsresult nsWidgetFactory::CreateInstance(nsISupports *aOuter,
else if (mClassID.Equals(kCMenuItem)) {
inst = (nsISupports*)new nsMenuItem();
}
/* XXX Not checked in yet inst = (nsISupports*)(nsWindow*)new nsImageButton();
else if (mClassID.Equals(kCImageButton)) {
inst = (nsISupports*)(nsWindow*)new nsImageButton();
}
else if (mClassID.Equals(kCMenuButton)) {
inst = (nsISupports*)(nsWindow*)new nsMenuButton();
@ -231,7 +230,7 @@ nsresult nsWidgetFactory::CreateInstance(nsISupports *aOuter,
else if (mClassID.Equals(kCToolBarItemHolder)) {
inst = (nsISupports*)(nsIToolbarItemHolder *) new nsToolbarItemHolder();
}
*/
else if (mClassID.Equals(kCPopUpMenu)) {
inst = (nsISupports*)new nsPopUpMenu();
}

View File

@ -20,7 +20,7 @@ DEPTH = ../../..
include $(DEPTH)/config/config.mk
LIBRARY_NAME = widgetunix
LIBRARY_NAME = raptorwidgetunix_s
MODULE=raptor
@ -28,27 +28,13 @@ REQUIRES=util img xpcom raptor netlib
DEFINES = -D_IMPL_NS_WIDGET
EXTRA_DSO_LDOPTS+=\
$(DIST)/bin/libxpcom.so \
$(DIST)/bin/libraptorbase.so \
$(DIST)/bin/libreg.so \
$(LIBNSPR)\
$(DIST)/lib/libplc21.a
# This should really be done properly in 'config'
ifeq ($(OS_ARCH),Linux)
EXTRA_DSO_LDOPTS+=\
-L/usr/X11R6/lib -lX11 -lm
else
EXTRA_DSO_LDOPTS+= -lXm -lXt -lX11 -lm
endif
INCLUDES+= -I../xpwidgets -I../motif -I.
CPPSRCS= \
nsMenuBar.cpp \
nsMenu.cpp \
nsMenuItem.cpp \
nsPopUpMenu.cpp \
nsWidgetSupport.cpp \
nsComboBox.cpp \
nsTextHelper.cpp \
nsTextAreaWidget.cpp \
@ -64,14 +50,12 @@ CPPSRCS= \
nsToolkit.cpp \
nsLabel.cpp \
nsDialog.cpp \
nsWidgetFactory.cpp \
nsWindow.cpp \
nsXtEventHandler.cpp \
nsXtManageWidget.cpp
CPP_OBJS= \
./$(OBJDIR)/nsPopUpMenu.o \
./$(OBJDIR)/nsWidgetSupport.o \
./$(OBJDIR)/nsComboBox.o \
./$(OBJDIR)/nsFileWidget.o \
./$(OBJDIR)/nsTextHelper.o \
@ -89,15 +73,15 @@ CPP_OBJS= \
./$(OBJDIR)/nsToolkit.o \
./$(OBJDIR)/nsLabel.o \
./$(OBJDIR)/nsDialog.o \
./$(OBJDIR)/nsWidgetFactory.o \
./$(OBJDIR)/nsWindow.o \
./$(OBJDIR)/nsXtEventHandler.o \
$(NULL)
include $(DEPTH)/config/config.mk
TARGETS = $(LIBRARY)
MKSHLIB :=
include $(DEPTH)/config/rules.mk

View File

@ -20,7 +20,10 @@
#include "nsIAppShell.h"
#include <stdlib.h>
XtAppContext gAppContext;
extern XtAppContext gAppContext;
//XtAppContext nsAppShell::gAppContext = NULL;
//-------------------------------------------------------------------------
//
@ -34,6 +37,7 @@ NS_IMPL_ISUPPORTS(nsAppShell,kIAppShellIID);
NS_METHOD nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListener)
{
mDispatchListener = aDispatchListener;
return NS_OK;
}
@ -48,6 +52,7 @@ NS_METHOD nsAppShell::Create(int* argc, char ** argv)
XtSetLanguageProc(NULL, NULL, NULL);
mTopLevel = XtVaAppInitialize(&mAppContext, "nsAppShell", NULL,
0, argc, argv, NULL, NULL);
// XXX This is BAD -- needs to be fixed
gAppContext = mAppContext;
return NS_OK;
}

View File

@ -46,6 +46,9 @@ class nsAppShell : public nsIAppShell
NS_IMETHOD Exit();
NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener);
virtual void* GetNativeData(PRUint32 aDataType);
// Public global
//static XtAppContext gAppContext;
};
#endif // nsAppShell_h__

View File

@ -27,6 +27,7 @@
#include "nsGfxCIID.h"
#include "nsXtEventHandler.h"
#include "nsAppShell.h"
#include "X11/Xlib.h"
#include "Xm/Xm.h"
@ -48,12 +49,12 @@
Widget gFirstTopLevelWindow = 0; //XXX: REMOVE Kludge should not be needed.
extern XtAppContext gAppContext;
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
NS_IMPL_ADDREF(nsWindow)
NS_IMPL_RELEASE(nsWindow)
extern XtAppContext gAppContext;
//-------------------------------------------------------------------------
//
@ -261,6 +262,7 @@ void nsWindow::CreateMainWindow(nsNativeWidget aNativeParent,
// save the event callback function
mEventCallback = aHandleEventFunction;
printf("************* CreateMainWindow 0x%x\n", mEventCallback);
InitDeviceContext(aContext,
(Widget) aAppShell->GetNativeData(NS_NATIVE_SHELL));
@ -337,6 +339,7 @@ void nsWindow::CreateChildWindow(nsNativeWidget aNativeParent,
// save the event callback function
mEventCallback = aHandleEventFunction;
printf("************* CreateChildWindow 0x%x\n", mEventCallback);
InitDeviceContext(aContext, (Widget)aNativeParent);
@ -684,6 +687,7 @@ NS_METHOD nsWindow::Resize(PRUint32 aX, PRUint32 aY, PRUint32 aWidth, PRUint32 a
mBounds.height = aHeight;
XtVaSetValues(mWidget, XmNx, aX, XmNy, GetYCoord(aY),
XmNwidth, aWidth, XmNheight, aHeight, nsnull);
printf("After nsWindow::Resize\n");
return NS_OK;
}
@ -726,7 +730,12 @@ NS_METHOD nsWindow::SetFocus(void)
//-------------------------------------------------------------------------
void nsWindow::SetBounds(const nsRect &aRect)
{
Resize(mBounds.x, mBounds.y, mBounds.width, mBounds.height, PR_TRUE);
mBounds.x = aRect.x;
mBounds.y = aRect.y;
mBounds.width = aRect.width;
mBounds.height = aRect.height;
printf("SetBounds\n");
//Resize(mBounds.x, mBounds.y, mBounds.width, mBounds.height, PR_TRUE);
}
//-------------------------------------------------------------------------
@ -1231,7 +1240,9 @@ NS_IMETHODIMP nsWindow::DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus
aStatus = nsEventStatus_eIgnore;
if (nsnull != mEventCallback) {
printf("Before Dispatch 0x%x\n", mEventCallback);
aStatus = (*mEventCallback)(event);
printf("After Dispatch\n");
}
// Dispatch to event listener if event was not consumed
@ -1514,15 +1525,18 @@ void nsWindow_Refresh_Callback(XtPointer call_data)
widgetWindow->SetBounds(bounds);
widgetWindow->OnResize(event);
printf("nsWindow_ResetResize_Callback 1\n");
nsPaintEvent pevent;
pevent.message = NS_PAINT;
pevent.widget = widgetWindow;
pevent.time = 0;
pevent.rect = (nsRect *)&bounds;
printf("nsWindow_ResetResize_Callback 2\n");
widgetWindow->OnPaint(pevent);
printf("nsWindow_ResetResize_Callback 3 0x%x\n", gAppContext);
XtAppAddTimeOut(gAppContext, 50, (XtTimerCallbackProc)nsWindow_ResetResize_Callback, widgetWindow);
printf("nsWindow_ResetResize_Callback 4\n");
}
//

View File

@ -32,8 +32,6 @@
#define DBG 0
extern XtAppContext gAppContext;
struct nsKeyConverter {
int vkCode; // Platform independent key code
XID keysym; // X keysym key code

View File

@ -15,9 +15,38 @@
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../..
include manifest.mn
include $(DEPTH)/config/config.mk
LIBRARY_NAME = raptorbasewidget_s
#LCFLAGS=-D_IMPL_NS_WIDGET
ifeq ($(OS_TARGET),Rhapsody)
INCLUDES += -I$(PUBLIC)/xpcom -I$(PUBLIC)/raptor -I../rhapsody
else
INCLUDES += -I../public -I$(PUBLIC)/xpcom -I$(PUBLIC)/raptor -I../motif -I.
endif
CPPSRCS=nsBaseWidget.cpp \
nsMenuButton.cpp \
nsToolbarItemHolder.cpp \
nsToolbarManager.cpp \
nsImageButton.cpp \
nsToolbar.cpp \
$(NULL)
MODULE=raptor
REQUIRES=util img xpcom raptor netlib
TARGETS = $(LIBRARY)
MKSHLIB :=
include $(DEPTH)/config/rules.mk

View File

@ -50,10 +50,12 @@ const PRInt32 kAlignJustText = 0;
const PRInt32 kAlignJustImage = 1;
const PRInt32 kAlignBoth = 2;
//---------------------------------------------------------------
static nsEventStatus PR_CALLBACK
HandleImageButtonEvent(nsGUIEvent *aEvent)
{
printf("HandleImageButtonEvent\n");
nsEventStatus result = nsEventStatus_eIgnore;
nsIImageButton * button;
if (NS_OK == aEvent->widget->QueryInterface(kCIImageButtonIID,(void**)&button)) {
@ -139,8 +141,9 @@ NS_METHOD nsImageButton::Create(nsIWidget *aParent,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData)
{
printf("nsImageButton::Create 0x%x 0x%x\n", aHandleEventFunction, HandleImageButtonEvent);
return ChildWindow::Create(aParent, aRect,
nsnull != aHandleEventFunction ? aHandleEventFunction:HandleImageButtonEvent,
nsnull != aHandleEventFunction ? aHandleEventFunction: HandleImageButtonEvent,
aContext, aAppShell, aToolkit, aInitData);
}
@ -558,14 +561,18 @@ nsEventStatus nsImageButton::HandleEvent(nsGUIEvent *aEvent)
rect.y = ((nsPaintEvent *)aEvent)->rect->y;
rect.width = ((nsPaintEvent *)aEvent)->rect->width;
rect.height = ((nsPaintEvent *)aEvent)->rect->height;
printf("---> 1\n");
aEvent->widget->GetBounds(rect);
rect.x = 0;
rect.y = 0;
printf("---> 1 %x\n", ctx);
ds = ctx->CreateDrawingSurface(&rect);
printf("---> 1\n");
if (ds == nsnull) {
printf("---> 1\n");
return nsEventStatus_eConsumeNoDefault;
}
printf("---> 1\n");
ctx->SelectOffScreenDrawingSurface(ds);
es = OnPaint((*((nsPaintEvent*)aEvent)->renderingContext),(*((nsPaintEvent*)aEvent)->rect));

View File

@ -195,6 +195,7 @@ NS_METHOD nsToolbarManager::AddTabToManager(nsIToolbar * aToolbar,
nsIWidget * widget;
if (NS_OK == tab->QueryInterface(kIWidgetIID,(void**)&widget)) {
printf("Adding tab to Toolbar\n");
widget->Create(parent, rt, NULL, NULL);
widget->Show(PR_TRUE);
@ -263,6 +264,7 @@ NS_METHOD nsToolbarManager::AddTabToToolbar(nsIToolbar * aToolbar)
// and it can be put into the generic ToolbarItemHolder
nsIWidget * widget;
if (NS_OK == tab->QueryInterface(kIWidgetIID,(void**)&widget)) {
printf("Adding tab to Toolbar\n");
widget->Create(parent, rt, NULL, NULL);
widget->Show(PR_TRUE);
widget->SetClientData((void *)parent);
@ -295,13 +297,15 @@ NS_METHOD nsToolbarManager::AddTabToToolbar(nsIToolbar * aToolbar)
//--------------------------------------------------------------------
NS_METHOD nsToolbarManager::AddToolbar(nsIToolbar* aToolbar)
{
printf("In AddTabToToolbar\n");
mToolbars[mNumToolbars] = aToolbar;
mNumToolbars++;
// XXX should check here to make sure it isn't already added
aToolbar->SetToolbarManager(this);
printf("Before AddTabToToolbar\n");
AddTabToToolbar(aToolbar);
printf("After AddTabToToolbar\n");
NS_ADDREF(aToolbar);
return NS_OK;