diff --git a/mozilla/xpfc/msg/manifest.mn b/mozilla/xpfc/msg/manifest.mn index 3a56436c42d..9d2b6d46904 100644 --- a/mozilla/xpfc/msg/manifest.mn +++ b/mozilla/xpfc/msg/manifest.mn @@ -11,5 +11,6 @@ GDEPTH = ../.. DEPTH = ../.. #DIRS_EXPORT = public inc -#DIRS_LIBS = src +#DIRS_LIBS = src +DIRS = test diff --git a/mozilla/xpfc/msg/test/Makefile b/mozilla/xpfc/msg/test/Makefile new file mode 100644 index 00000000000..61267ebf415 --- /dev/null +++ b/mozilla/xpfc/msg/test/Makefile @@ -0,0 +1,53 @@ +#! gmake +# +# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF +# NETSCAPE COMMUNICATIONS CORPORATION +# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights +# Reserved. Use of this Source Code is subject to the terms of the +# applicable license agreement from Netscape Communications Corporation. +# The copyright notice(s) in this Source Code does not indicate actual or +# intended publication of this Source Code. +# + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(GDEPTH)/gconfig/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + + + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(GDEPTH)/gconfig/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + + diff --git a/mozilla/xpfc/msg/test/inc/Makefile b/mozilla/xpfc/msg/test/inc/Makefile new file mode 100644 index 00000000000..61267ebf415 --- /dev/null +++ b/mozilla/xpfc/msg/test/inc/Makefile @@ -0,0 +1,53 @@ +#! gmake +# +# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF +# NETSCAPE COMMUNICATIONS CORPORATION +# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights +# Reserved. Use of this Source Code is subject to the terms of the +# applicable license agreement from Netscape Communications Corporation. +# The copyright notice(s) in this Source Code does not indicate actual or +# intended publication of this Source Code. +# + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(GDEPTH)/gconfig/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + + + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(GDEPTH)/gconfig/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + + diff --git a/mozilla/xpfc/msg/test/inc/manifest.mn b/mozilla/xpfc/msg/test/inc/manifest.mn new file mode 100644 index 00000000000..2605069de24 --- /dev/null +++ b/mozilla/xpfc/msg/test/inc/manifest.mn @@ -0,0 +1,24 @@ +# +# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF +# NETSCAPE COMMUNICATIONS CORPORATION +# Copyright (C) 1996 Netscape Communications Corporation. All Rights +# Reserved. Use of this Source Code is subject to the terms of the +# applicable license agreement from Netscape Communications Corporation. +# The copyright notice(s) in this Source Code does not indicate actual or +# intended publication of this Source Code. +# +GDEPTH = ../../../.. + +EXPORTS = \ + nsMsgTest.h \ + $(NULL) + +PRIVATE_EXPORTS = \ + nsMsgTest.h \ + nsMsgTestCIID.h \ + nsMsgTestFactory.h \ + $(NULL) + +MODULE = trex + +REQUIRES = raptor xpfc msgsdk diff --git a/mozilla/xpfc/msg/test/inc/nsMsgTest.h b/mozilla/xpfc/msg/test/inc/nsMsgTest.h new file mode 100644 index 00000000000..b0e204f20bf --- /dev/null +++ b/mozilla/xpfc/msg/test/inc/nsMsgTest.h @@ -0,0 +1,71 @@ +/* -*- 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. + */ + +#ifndef _nsMsgTest_h__ +#define _nsMsgTest_h__ + +#include "nsIMsgTest.h" +#include "nsIFactory.h" +#include "nsRepository.h" +#include "nsIShellInstance.h" +#include "nsIWidget.h" +#include "nsGUIEvent.h" +#include "nsRect.h" +#include "nsApplicationManager.h" +#include "nsIContentViewer.h" +#include "nsCRT.h" +#include "plstr.h" +#include "nsIWidget.h" +#include "nsITextWidget.h" +#include "nsITextAreaWidget.h" +#include "nspr.h" +#include "jsapi.h" +#include "nsIStreamListener.h" + +class nsMsgTest : public nsIMsgTest +{ +public: + nsMsgTest(); + ~nsMsgTest(); + + NS_DECL_ISUPPORTS + + NS_IMETHOD Init(); + + // nsIAppShell interfaces + NS_IMETHOD Create(int* argc, char ** argv) ; + NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener) ; + NS_IMETHOD Exit(); + virtual nsresult Run(); + virtual void* GetNativeData(PRUint32 aDataType) ; + + NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) ; + NS_IMETHOD GetWebViewerContainer(nsIWebViewerContainer ** aWebViewerContainer) ; + + NS_IMETHOD ReceiveCommand(nsString& aCommand, nsString& aReply); + NS_IMETHOD StartCommandServer(); + +private: + NS_METHOD RegisterFactories(); + +private: + nsIShellInstance * mShellInstance ; + +}; + +#endif diff --git a/mozilla/xpfc/msg/test/inc/nsMsgTestCIID.h b/mozilla/xpfc/msg/test/inc/nsMsgTestCIID.h new file mode 100644 index 00000000000..f9d369d4af0 --- /dev/null +++ b/mozilla/xpfc/msg/test/inc/nsMsgTestCIID.h @@ -0,0 +1,33 @@ +/* -*- 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. + */ + +#ifndef nsMsgTestCIID_h__ +#define nsMsgTestCIID_h__ + +#include "nsISupports.h" +#include "nsIFactory.h" +#include "nsRepository.h" + +//5d8cb490-6f5d-11d2-8dbc-00805f8a7ab6 +#define NS_MSGTEST_CID \ +{ 0x5d8cb490, 0x6f5d, 0x11d2, \ +{ 0x8d, 0xbc, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } + + + +#endif diff --git a/mozilla/xpfc/msg/test/inc/nsMsgTestFactory.h b/mozilla/xpfc/msg/test/inc/nsMsgTestFactory.h new file mode 100644 index 00000000000..0772679bb88 --- /dev/null +++ b/mozilla/xpfc/msg/test/inc/nsMsgTestFactory.h @@ -0,0 +1,49 @@ +/* -*- 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. + */ + +#include "nscore.h" +#include "nsIFactory.h" +#include "nsISupports.h" +#include "nsMsgTestCIID.h" + +#include "nsMsgTest.h" + +class nsMsgTestFactory : public nsIFactory +{ + public: + // nsISupports methods + NS_IMETHOD QueryInterface(const nsIID &aIID, + void **aResult); + NS_IMETHOD_(nsrefcnt) AddRef(void); + NS_IMETHOD_(nsrefcnt) Release(void); + + // nsIFactory methods + NS_IMETHOD CreateInstance(nsISupports *aOuter, + const nsIID &aIID, + void **aResult); + + NS_IMETHOD LockFactory(PRBool aLock); + + nsMsgTestFactory(const nsCID &aClass); + ~nsMsgTestFactory(); + + private: + nsrefcnt mRefCnt; + nsCID mClassID; +}; + diff --git a/mozilla/xpfc/msg/test/manifest.mn b/mozilla/xpfc/msg/test/manifest.mn new file mode 100644 index 00000000000..8e4420ee209 --- /dev/null +++ b/mozilla/xpfc/msg/test/manifest.mn @@ -0,0 +1,15 @@ +# +# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF +# NETSCAPE COMMUNICATIONS CORPORATION +# Copyright (C) 1996 Netscape Communications Corporation. All Rights +# Reserved. Use of this Source Code is subject to the terms of the +# applicable license agreement from Netscape Communications Corporation. +# The copyright notice(s) in this Source Code does not indicate actual or +# intended publication of this Source Code. +# +GDEPTH = ../../.. +DEPTH = ../../.. + +DIRS_EXPORT = public inc +DIRS_LIBS = src + diff --git a/mozilla/xpfc/msg/test/public/Makefile b/mozilla/xpfc/msg/test/public/Makefile new file mode 100644 index 00000000000..61267ebf415 --- /dev/null +++ b/mozilla/xpfc/msg/test/public/Makefile @@ -0,0 +1,53 @@ +#! gmake +# +# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF +# NETSCAPE COMMUNICATIONS CORPORATION +# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights +# Reserved. Use of this Source Code is subject to the terms of the +# applicable license agreement from Netscape Communications Corporation. +# The copyright notice(s) in this Source Code does not indicate actual or +# intended publication of this Source Code. +# + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(GDEPTH)/gconfig/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + + + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(GDEPTH)/gconfig/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + + diff --git a/mozilla/xpfc/msg/test/public/manifest.mn b/mozilla/xpfc/msg/test/public/manifest.mn new file mode 100644 index 00000000000..c259415d9b0 --- /dev/null +++ b/mozilla/xpfc/msg/test/public/manifest.mn @@ -0,0 +1,22 @@ +# +# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF +# NETSCAPE COMMUNICATIONS CORPORATION +# Copyright (C) 1996 Netscape Communications Corporation. All Rights +# Reserved. Use of this Source Code is subject to the terms of the +# applicable license agreement from Netscape Communications Corporation. +# The copyright notice(s) in this Source Code does not indicate actual or +# intended publication of this Source Code. +# +GDEPTH = ../../../.. +DEPTH = ../../../.. + +EXPORTS = \ + nsIMsgTest.h \ + $(NULL) + +PRIVATE_EXPORTS = \ + $(NULL) + +MODULE = trex + +REQUIRES = raptor xpfc msgsdk diff --git a/mozilla/xpfc/msg/test/public/nsIMsgTest.h b/mozilla/xpfc/msg/test/public/nsIMsgTest.h new file mode 100644 index 00000000000..233e1d47708 --- /dev/null +++ b/mozilla/xpfc/msg/test/public/nsIMsgTest.h @@ -0,0 +1,42 @@ +/* -*- 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. + */ +#ifndef nsIMsgTest_h___ +#define nsIMsgTest_h___ + +#include "nsISupports.h" +#include "nsIApplicationShell.h" +#include "nscore.h" +#include "nsIAppShell.h" + +//59b16ff0-6f5c-11d2-8dbc-00805f8a7ab6 +#define NS_IMSGTEST_IID \ +{ 0x59b16ff0, 0x6f5c, 0x11d2, \ +{ 0x8d, 0xbc, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } + +// Interface to the application shell. +class nsIMsgTest : public nsIApplicationShell, + public nsIAppShell +{ + +public: + + NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) = 0 ; + +}; + +#endif /* nsIMsgTest_h___ */ diff --git a/mozilla/xpfc/msg/test/src/Makefile b/mozilla/xpfc/msg/test/src/Makefile new file mode 100644 index 00000000000..60df328e33a --- /dev/null +++ b/mozilla/xpfc/msg/test/src/Makefile @@ -0,0 +1,54 @@ +#! gmake +# +# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF +# NETSCAPE COMMUNICATIONS CORPORATION +# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights +# Reserved. Use of this Source Code is subject to the terms of the +# applicable license agreement from Netscape Communications Corporation. +# The copyright notice(s) in this Source Code does not indicate actual or +# intended publication of this Source Code. +# + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(GDEPTH)/gconfig/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +include config.mk + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(GDEPTH)/gconfig/ruleset.mk +include $(GDEPTH)/gconfig/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + + + diff --git a/mozilla/xpfc/msg/test/src/config.mk b/mozilla/xpfc/msg/test/src/config.mk new file mode 100644 index 00000000000..3cfdf1f8437 --- /dev/null +++ b/mozilla/xpfc/msg/test/src/config.mk @@ -0,0 +1,66 @@ +# +# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF +# NETSCAPE COMMUNICATIONS CORPORATION +# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights +# Reserved. Use of this Source Code is subject to the terms of the +# applicable license agreement from Netscape Communications Corporation. +# The copyright notice(s) in this Source Code does not indicate actual or +# intended publication of this Source Code. +# + +# +# Override TARGETS variable so that only static libraries +# are specifed as dependencies within rules.mk. +# + +CFLAGS +=-D_IMPL_NS_MSGTEST -DNSPR20 -I$(GDEPTH)/include + +PROGRAM = msgtest + +OS_LIBS += $(GUI_LIBS) + +LD_LIBS += \ + raptorbase \ + raptorhtmlpars \ + raptorhtml \ + png \ + abouturl \ + fileurl \ + ftpurl \ + gophurl \ + httpurl \ + $(XP_PREF_DLL) \ + img$(MOZ_BITS)$(VERSION_NUMBER) \ + jpeg$(MOZ_BITS)$(VERSION_NUMBER) \ + js$(MOZ_BITS)$(VERSION_NUMBER) \ + jsdom \ + mimetype \ + netlib \ + remoturl \ + netcache \ + netcnvts \ + netutil \ + network \ + netlib \ + xpfc10 \ + $(NATIVE_RAPTOR_WIDGET) \ + $(NATIVE_RAPTOR_GFX) \ + $(RAPTOR_GFX) \ + $(NATIVE_ZLIB_DLL) \ + $(NATIVE_XP_DLL) \ + $(NATIVE_LIBNLS_LIBS) \ + xpcom$(MOZ_BITS) \ + util10 \ + $(XP_REG_LIB) + +ifeq ($(OS_ARCH),Linux) +LD_LIBS += \ + secfree stubnj stubsj util xp pwcac dbm +endif + + +STATIC_LIBS += shell + +EXTRA_LIBS += \ + $(NSPR_LIBS) + diff --git a/mozilla/xpfc/msg/test/src/manifest.mn b/mozilla/xpfc/msg/test/src/manifest.mn new file mode 100644 index 00000000000..ef0f0133ebd --- /dev/null +++ b/mozilla/xpfc/msg/test/src/manifest.mn @@ -0,0 +1,27 @@ +# +# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF +# NETSCAPE COMMUNICATIONS CORPORATION +# Copyright (C) 1996 Netscape Communications Corporation. All Rights +# Reserved. Use of this Source Code is subject to the terms of the +# applicable license agreement from Netscape Communications Corporation. +# The copyright notice(s) in this Source Code does not indicate actual or +# intended publication of this Source Code. +# +GDEPTH = ../../../.. + +EXPORTS = \ + $(NULL) + +PRIVATE_EXPORTS = \ + $(NULL) + +MODULE = trex + +CPPSRCS = \ + nsMsgTest.cpp \ + nsMsgTestFactory.cpp \ + $(NULL) + + +REQUIRES = xpcom raptor julian nls netlib pref js xpfc trex msgsdk + diff --git a/mozilla/xpfc/msg/test/src/nsMsgTest.cpp b/mozilla/xpfc/msg/test/src/nsMsgTest.cpp new file mode 100644 index 00000000000..ee1bf32e131 --- /dev/null +++ b/mozilla/xpfc/msg/test/src/nsMsgTest.cpp @@ -0,0 +1,272 @@ +/* -*- 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. + */ + +#include "jdefines.h" +#include "nsMsgTest.h" +#include "nsxpfcCIID.h" +#include "nsIAppShell.h" +#include "nsMsgTestCIID.h" +#include "nsISupports.h" +#include "nsIFactory.h" +#include "nsRepository.h" +#include "nsMsgTestFactory.h" +#include "nsFont.h" +#include "nsITextWidget.h" +#include "nsITextAreaWidget.h" +#include "nsWidgetsCID.h" +#include "nsIDeviceContext.h" +#include "nsIFontMetrics.h" +#include "nspr.h" +#include "plgetopt.h" +#include "nsIURL.h" +#include "nsIStreamListener.h" +#include "nsIInputStream.h" +#include "nsCRT.h" +#include "jsapi.h" + +#ifdef NS_UNIX +#include "Xm/Xm.h" +#include "Xm/MainW.h" +#include "Xm/Frame.h" +#include "Xm/XmStrDefs.h" +#include "Xm/DrawingA.h" +#endif + + +static NS_DEFINE_IID(kITextWidgetIID, NS_ITEXTWIDGET_IID); +static NS_DEFINE_IID(kCTextAreaCID, NS_TEXTAREA_CID); +static NS_DEFINE_IID(kCTextFieldCID, NS_TEXTFIELD_CID); +static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); +static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID); +static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID); + +/* + * External refs + */ + +#ifdef NS_UNIX +extern XtAppContext app_context; +extern Widget topLevel; +#endif + +/* + * Local Globals + */ + +nsIMsgTest * gShell = nsnull; +nsIID kIXPCOMApplicationShellCID = NS_MSGTEST_CID ; + +/* + * Useage + */ + +static nsresult Usage(void) +{ + return 1; +} + + +// All Application Must implement this function +nsresult NS_RegisterApplicationShellFactory() +{ + + nsresult res = nsRepository::RegisterFactory(kIXPCOMApplicationShellCID, + new nsMsgTestFactory(kIXPCOMApplicationShellCID), + PR_FALSE) ; + + return res; +} + + +/* + * nsMsgTest Definition + */ + +nsMsgTest::nsMsgTest() +{ + NS_INIT_REFCNT(); + mShellInstance = nsnull ; + gShell = this; + +} + +/* + * nsMsgTest dtor + */ +nsMsgTest::~nsMsgTest() +{ +} + +/* + * nsISupports stuff + */ + +nsresult nsMsgTest::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + + if(aIID.Equals(kISupportsIID)) { //do IUnknown... + *aInstancePtr = (nsISupports*)(nsIApplicationShell *)(this); + } + else if(aIID.Equals(kIXPCOMApplicationShellCID)) { //do nsIContentSink base class... + *aInstancePtr = (nsIMsgTest*)(this); + } + else if(aIID.Equals(kIAppShellIID)) { //do nsIContentSink base class... + *aInstancePtr = (nsIAppShell*)(this); + } + else if(aIID.Equals(kIStreamListenerIID)) { //do nsIContentSink base class... + *aInstancePtr = (nsIStreamListener*)(this); + } + else { + *aInstancePtr=0; + return NS_NOINTERFACE; + } + ((nsISupports*) *aInstancePtr)->AddRef(); + return NS_OK; +} + +NS_IMPL_ADDREF(nsMsgTest) +NS_IMPL_RELEASE(nsMsgTest) + +/* + * Init + */ + +nsresult nsMsgTest::Init() +{ + + /* + * Register class factrories needed for application + */ + + RegisterFactories() ; + + nsresult res = nsApplicationManager::GetShellInstance(this, &mShellInstance) ; + + return res ; +} + + +nsresult nsMsgTest::Create(int* argc, char ** argv) +{ + return NS_OK; +} + +nsresult nsMsgTest::Exit() +{ + return NS_OK; +} + +nsresult nsMsgTest::Run() +{ + mShellInstance->Run(); + return NS_OK; +} + +nsresult nsMsgTest::SetDispatchListener(nsDispatchListener* aDispatchListener) +{ + return NS_OK; +} + +void* nsMsgTest::GetNativeData(PRUint32 aDataType) +{ +#ifdef XP_UNIX + if (aDataType == NS_NATIVE_SHELL) + return topLevel; + + return nsnull; +#else + return (mShellInstance->GetApplicationWidget()); +#endif + +} + +nsresult nsMsgTest::RegisterFactories() +{ +#ifdef NS_WIN32 + #define XPFC_DLL "xpfc10.dll" +#else + #define XPFC_DLL "libxpfc10.so" +#endif + + // register graphics classes + static NS_DEFINE_IID(kCXPFCCanvasCID, NS_XPFC_CANVAS_CID); + + nsRepository::RegisterFactory(kCXPFCCanvasCID, XPFC_DLL, PR_FALSE, PR_FALSE); + + static NS_DEFINE_IID(kCVectorCID, NS_VECTOR_CID); + static NS_DEFINE_IID(kCVectorIteratorCID, NS_VECTOR_ITERATOR_CID); + + nsRepository::RegisterFactory(kCVectorCID, XPFC_DLL, PR_FALSE, PR_FALSE); + nsRepository::RegisterFactory(kCVectorIteratorCID, XPFC_DLL, PR_FALSE, PR_FALSE); + + static NS_DEFINE_IID(kCXPFCObserverManagerCID, NS_XPFC_OBSERVERMANAGER_CID); + nsRepository::RegisterFactory(kCXPFCObserverManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE); + + return NS_OK; +} + +nsresult nsMsgTest::GetWebViewerContainer(nsIWebViewerContainer ** aWebViewerContainer) +{ + return NS_OK; +} + + +nsEventStatus nsMsgTest::HandleEvent(nsGUIEvent *aEvent) +{ + + nsEventStatus result = nsEventStatus_eConsumeNoDefault; + + switch(aEvent->message) { + + case NS_CREATE: + { + return nsEventStatus_eConsumeNoDefault; + } + break ; + + case NS_SIZE: + { + return nsEventStatus_eConsumeNoDefault; + } + break ; + + case NS_DESTROY: + { + mShellInstance->ExitApplication() ; + return nsEventStatus_eConsumeNoDefault; + } + break ; + } + + return nsEventStatus_eIgnore; +} + + +nsresult nsMsgTest::StartCommandServer() +{ + return NS_OK; +} + +nsresult nsMsgTest::ReceiveCommand(nsString& aCommand, nsString& aReply) +{ + return NS_OK; +} diff --git a/mozilla/xpfc/msg/test/src/nsMsgTestFactory.cpp b/mozilla/xpfc/msg/test/src/nsMsgTestFactory.cpp new file mode 100644 index 00000000000..d424ebe59e1 --- /dev/null +++ b/mozilla/xpfc/msg/test/src/nsMsgTestFactory.cpp @@ -0,0 +1,115 @@ +/* -*- 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. + */ + +#include "nscore.h" +#include "nsIFactory.h" +#include "nsISupports.h" +#include "nsMsgTestCIID.h" + +#include "nsMsgTest.h" +#include "nsMsgTestFactory.h" + +static NS_DEFINE_IID(kCMsgTest, NS_MSGTEST_CID); +static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); + +nsMsgTestFactory::nsMsgTestFactory(const nsCID &aClass) +{ + mRefCnt = 0; + mClassID = aClass; +} + +nsMsgTestFactory::~nsMsgTestFactory() +{ + NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction"); +} + +nsresult nsMsgTestFactory::QueryInterface(const nsIID &aIID, + void **aResult) +{ + if (aResult == NULL) { + return NS_ERROR_NULL_POINTER; + } + + // Always NULL result, in case of failure + *aResult = NULL; + + if (aIID.Equals(kISupportsIID)) { + *aResult = (void *)(nsISupports*)this; + } else if (aIID.Equals(kIFactoryIID)) { + *aResult = (void *)(nsIFactory*)this; + } + + if (*aResult == NULL) { + return NS_NOINTERFACE; + } + + AddRef(); // Increase reference count for caller + return NS_OK; +} + +nsrefcnt nsMsgTestFactory::AddRef() +{ + return ++mRefCnt; +} + +nsrefcnt nsMsgTestFactory::Release() +{ + if (--mRefCnt == 0) { + delete this; + return 0; // Don't access mRefCnt after deleting! + } + return mRefCnt; +} + +nsresult nsMsgTestFactory::CreateInstance(nsISupports *aOuter, + const nsIID &aIID, + void **aResult) +{ + if (aResult == NULL) { + return NS_ERROR_NULL_POINTER; + } + + *aResult = NULL; + + nsISupports *inst = nsnull; + + if (aIID.Equals(kCMsgTest)) { + inst = (nsISupports *)(nsIApplicationShell *)new nsMsgTest(); + } + + if (inst == NULL) { + return NS_ERROR_OUT_OF_MEMORY; + } + + nsresult res = inst->QueryInterface(aIID, aResult); + + if (res != NS_OK) { + // We didn't get the right interface, so clean up + delete inst; + } + + return res; +} + +nsresult nsMsgTestFactory::LockFactory(PRBool aLock) +{ + // Not implemented in simplest case. + return NS_OK; +} +