Adding CalendarModel framework to core

This commit is contained in:
spider%netscape.com 1998-09-17 20:14:25 +00:00
Родитель f0619b2c17
Коммит 97039a42ac
17 изменённых файлов: 231 добавлений и 34 удалений

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

@ -25,6 +25,7 @@ PRIVATE_EXPORTS = \
nsCalUser.h \ nsCalUser.h \
nsCalUserList.h \ nsCalUserList.h \
nsCalendarUser.h \ nsCalendarUser.h \
nsCalendarModel.h \
$(NULL) $(NULL)
MODULE = trex MODULE = trex

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

@ -0,0 +1,46 @@
/* -*- 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 nsCalendarModel_h___
#define nsCalendarModel_h___
#include "nscalexport.h"
#include "nsIModel.h"
#include "nsICalendarModel.h"
#include "nsICalendarUser.h"
class nsCalendarModel : public nsICalendarModel
{
public:
nsCalendarModel(nsISupports* outer);
~nsCalendarModel();
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD GetCalendarUser(nsICalendarUser *& aCalendarUser);
NS_IMETHOD SetCalendarUser(nsICalendarUser* aCalendarUser);
protected:
nsICalendarUser * mCalendarUser;
};
#endif //nsCalendarModel_h___

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

@ -39,4 +39,9 @@
{ 0x6858eab0, 0x4cd8, 0x11d2, \ { 0x6858eab0, 0x4cd8, 0x11d2, \
{0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} } {0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
// fd439e90-4e67-11d2-924a-00805f8a7ab6
#define NS_CALENDAR_MODEL_CID \
{ 0xfd439e90, 0x4e67, 0x11d2, \
{0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
#endif #endif

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

@ -1,24 +0,0 @@
#
# 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 = \
nsILayer.h \
nsILayerCollection.h \
nsICalendarUser.h \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
REQUIRES = raptor shell

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

@ -0,0 +1,43 @@
/* -*- 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 nsICalendarModel_h___
#define nsICalendarModel_h___
#include "nsISupports.h"
#include "nsILayer.h"
//317353e0-4e66-11d2-924a-00805f8a7ab6
#define NS_ICALENDAR_MODEL_IID \
{ 0x317353e0, 0x4e66, 0x11d2, \
{ 0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
class nsICalendarUser ;
class nsICalendarModel : public nsISupports
{
public:
NS_IMETHOD Init() = 0;
NS_IMETHOD GetCalendarUser(nsICalendarUser *& aCalendarUser) = 0;
NS_IMETHOD SetCalendarUser(nsICalendarUser* aCalendarUser) = 0;
};
#endif /* nsICalendarModel */

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

@ -29,6 +29,7 @@ CPPSRCS = \
nsLayerCollection.cpp \ nsLayerCollection.cpp \
nsCoreFactory.cpp \ nsCoreFactory.cpp \
nsCalendarUser.cpp \ nsCalendarUser.cpp \
nsCalendarModel.cpp \
$(NULL) $(NULL)

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

@ -0,0 +1,85 @@
/* -*- 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 <stdio.h>
#include "nscore.h"
#include "nsCalendarModel.h"
#include "nsCoreCIID.h"
#include "nsxpfcCIID.h"
#include "nsICalendarUser.h"
static NS_DEFINE_IID(kICalendarModelIID, NS_ICALENDAR_MODEL_IID);
static NS_DEFINE_IID(kIModelIID, NS_IMODEL_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
nsCalendarModel::nsCalendarModel(nsISupports* outer)
{
NS_INIT_REFCNT();
mCalendarUser = nsnull;
}
nsresult nsCalendarModel::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kClassIID, kICalendarModelIID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (NS_NOINTERFACE);
}
NS_IMPL_ADDREF(nsCalendarModel)
NS_IMPL_RELEASE(nsCalendarModel)
nsCalendarModel::~nsCalendarModel()
{
mCalendarUser = nsnull; // Do Not Release
}
nsresult nsCalendarModel::Init()
{
return NS_OK;
}
NS_IMETHODIMP nsCalendarModel :: GetCalendarUser(nsICalendarUser *& aCalendarUser)
{
aCalendarUser = mCalendarUser;
return NS_OK;
}
NS_IMETHODIMP nsCalendarModel :: SetCalendarUser(nsICalendarUser* aCalendarUser)
{
mCalendarUser = aCalendarUser;
return NS_OK;
}

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

@ -23,14 +23,15 @@
#include "nsLayer.h" #include "nsLayer.h"
#include "nsCalendarUser.h" #include "nsCalendarUser.h"
#include "nsCalendarModel.h"
static NS_DEFINE_IID(kILayerIID, NS_ILAYER_IID); static NS_DEFINE_IID(kILayerIID, NS_ILAYER_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
static NS_DEFINE_IID(kICalUSerIID, NS_ICALENDAR_USER_IID); static NS_DEFINE_IID(kICalUSerIID, NS_ICALENDAR_USER_IID);
static NS_DEFINE_IID(kCLayerCID, NS_LAYER_CID);
static NS_DEFINE_IID(kCLayerCID, NS_LAYER_CID); static NS_DEFINE_IID(kCCalendarUserCID, NS_CALENDAR_USER_CID);
static NS_DEFINE_IID(kCCalendarUserCID, NS_CALENDAR_USER_CID); static NS_DEFINE_IID(kCCalendarModelCID, NS_CALENDAR_MODEL_CID);
class nsCoreFactory : public nsIFactory class nsCoreFactory : public nsIFactory
{ {
@ -121,6 +122,8 @@ nsresult nsCoreFactory::CreateInstance(nsISupports *aOuter,
inst = (nsISupports *)new nsLayer(aOuter); inst = (nsISupports *)new nsLayer(aOuter);
} else if (mClassID.Equals(kCCalendarUserCID)) { } else if (mClassID.Equals(kCCalendarUserCID)) {
inst = (nsISupports *)new nsCalendarUser(aOuter); inst = (nsISupports *)new nsCalendarUser(aOuter);
} else if (mClassID.Equals(kCCalendarModelCID)) {
inst = (nsISupports *)new nsCalendarModel(aOuter);
} }
if (inst == NULL) { if (inst == NULL) {

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

@ -32,7 +32,6 @@ LD_LIBS += \
jpeg$(MOZ_BITS)$(VERSION_NUMBER) \ jpeg$(MOZ_BITS)$(VERSION_NUMBER) \
js$(MOZ_BITS)$(VERSION_NUMBER) \ js$(MOZ_BITS)$(VERSION_NUMBER) \
jsdom \ jsdom \
jsj$(MOZ_BITS)$(VERSION_NUMBER) \
mimetype \ mimetype \
netlib \ netlib \
remoturl \ remoturl \

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

@ -51,6 +51,8 @@
#include "nsCoreCIID.h" #include "nsCoreCIID.h"
#include "nsLayer.h" #include "nsLayer.h"
#include "nsCalUser.h" #include "nsCalUser.h"
#include "nsCalendarUser.h"
#include "nsCalendarModel.h"
/* for CAPI to work in general form */ /* for CAPI to work in general form */
#include "nsCapiCallbackReader.h" #include "nsCapiCallbackReader.h"
@ -92,6 +94,8 @@ static NS_DEFINE_IID(kCCapiLocalCID, NS_CAPI_LOCAL_CID);
static NS_DEFINE_IID(kCCapiCSTCID, NS_CAPI_CST_CID); static NS_DEFINE_IID(kCCapiCSTCID, NS_CAPI_CST_CID);
static NS_DEFINE_IID(kCLayerCID, NS_LAYER_CID); static NS_DEFINE_IID(kCLayerCID, NS_LAYER_CID);
static NS_DEFINE_IID(kCLayerCollectionCID, NS_LAYER_COLLECTION_CID); static NS_DEFINE_IID(kCLayerCollectionCID, NS_LAYER_COLLECTION_CID);
static NS_DEFINE_IID(kCCalendarUserCID, NS_CALENDAR_USER_CID);
static NS_DEFINE_IID(kCCalendarModelCID, NS_CALENDAR_MODEL_CID);
// All Application Must implement this function // All Application Must implement this function
nsresult NS_RegisterApplicationShellFactory() nsresult NS_RegisterApplicationShellFactory()
@ -695,6 +699,8 @@ nsresult nsCalendarShell::RegisterFactories()
nsRepository::RegisterFactory(kCCapiCSTCID, CAPI_DLL, PR_FALSE, PR_FALSE); nsRepository::RegisterFactory(kCCapiCSTCID, CAPI_DLL, PR_FALSE, PR_FALSE);
// Register the Core Implementations // Register the Core Implementations
nsRepository::RegisterFactory(kCCalendarUserCID, CORE_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCCalendarModelCID, CORE_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCLayerCID, CORE_DLL, PR_FALSE, PR_FALSE); nsRepository::RegisterFactory(kCLayerCID, CORE_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCLayerCollectionCID, CORE_DLL, PR_FALSE, PR_FALSE); nsRepository::RegisterFactory(kCLayerCollectionCID, CORE_DLL, PR_FALSE, PR_FALSE);

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

@ -32,7 +32,6 @@ LD_LIBS += \
jpeg$(MOZ_BITS)$(VERSION_NUMBER) \ jpeg$(MOZ_BITS)$(VERSION_NUMBER) \
js$(MOZ_BITS)$(VERSION_NUMBER) \ js$(MOZ_BITS)$(VERSION_NUMBER) \
jsdom \ jsdom \
jsj$(MOZ_BITS)$(VERSION_NUMBER) \
mimetype \ mimetype \
netlib \ netlib \
remoturl \ remoturl \

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

@ -28,6 +28,7 @@ LD_LIBS += \
nscnv$(MOZ_BITS)30 \ nscnv$(MOZ_BITS)30 \
nssb$(MOZ_BITS)30 \ nssb$(MOZ_BITS)30 \
xpfc10 \ xpfc10 \
calcore10 \
$(XP_REG_LIB) $(XP_REG_LIB)
AR_LIBS += \ AR_LIBS += \

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

@ -41,6 +41,7 @@
#include "nsIImageObserver.h" #include "nsIImageObserver.h"
#include "nsIImageRequest.h" #include "nsIImageRequest.h"
#include "nsIView.h" #include "nsIView.h"
#include "nsIModel.h"
CLASS_EXPORT_XPFC nsXPFCCanvas : public nsIXPFCCanvas, CLASS_EXPORT_XPFC nsXPFCCanvas : public nsIXPFCCanvas,
public nsIXPFCObserver, public nsIXPFCObserver,
@ -70,6 +71,9 @@ public:
NS_IMETHOD_(nsString&) GetLabel(); NS_IMETHOD_(nsString&) GetLabel();
NS_IMETHOD SetLabel(nsString& aString); NS_IMETHOD SetLabel(nsString& aString);
NS_IMETHOD_(nsIModel *) GetModel();
NS_IMETHOD SetModel(nsIModel * aModel);
NS_IMETHOD SetBounds(const nsRect& aBounds); NS_IMETHOD SetBounds(const nsRect& aBounds);
NS_IMETHOD_(void) GetBounds(nsRect& aRect); NS_IMETHOD_(void) GetBounds(nsRect& aRect);
@ -274,6 +278,7 @@ private:
nsFont mFont; nsFont mFont;
PRUint32 mTabID; PRUint32 mTabID;
PRUint32 mTabGroup; PRUint32 mTabGroup;
nsIModel * mModel;
protected: protected:

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

@ -31,6 +31,8 @@
#include "nsIFontMetrics.h" #include "nsIFontMetrics.h"
#include "nsIRenderingContext.h" #include "nsIRenderingContext.h"
class nsIModel;
// IID for the nsIXPFCCanvas interface // IID for the nsIXPFCCanvas interface
#define NS_IXPFC_CANVAS_IID \ #define NS_IXPFC_CANVAS_IID \
{ 0x6bc9da40, 0xe9e7, 0x11d1, \ { 0x6bc9da40, 0xe9e7, 0x11d1, \
@ -93,6 +95,13 @@ public:
NS_IMETHOD_(nsILayout *) GetLayout() = 0; NS_IMETHOD_(nsILayout *) GetLayout() = 0;
NS_IMETHOD SetLayout(nsILayout * aLayout) = 0; NS_IMETHOD SetLayout(nsILayout * aLayout) = 0;
/**
* Get a pointer to the object implementing the nsIModel interface for this canvas
* @result nsIModel pointer, nsnull if no model object assigned, else a pointer to the model object
*/
NS_IMETHOD_(nsIModel *) GetModel() = 0;
NS_IMETHOD SetModel(nsIModel * aModel) = 0;
/** /**
* Get the Name of this canvas, relative to itself * Get the Name of this canvas, relative to itself
* @result nsString reference, the name of the canvas * @result nsString reference, the name of the canvas

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

@ -110,6 +110,7 @@ nsXPFCCanvas :: nsXPFCCanvas(nsISupports* outer) :
mImageRequest = nsnull; mImageRequest = nsnull;
mView = nsnull; mView = nsnull;
mModel = nsnull;
} }
@ -664,6 +665,17 @@ nsresult nsXPFCCanvas :: SetLayout(nsILayout * aLayout)
return NS_OK; return NS_OK;
} }
nsIModel * nsXPFCCanvas :: GetModel()
{
return mModel;
}
nsresult nsXPFCCanvas :: SetModel(nsIModel * aModel)
{
mModel = aModel;
return NS_OK;
}
nsresult nsXPFCCanvas :: Init() nsresult nsXPFCCanvas :: Init()
{ {

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

@ -10,7 +10,7 @@
GDEPTH = .. GDEPTH = ..
DEPTH = .. DEPTH = ..
DIRS = core canvas command dialog layout network observer util parser chrome shell toolkit widget user DIRS = core canvas command dialog layout network observer util parser chrome shell toolkit widget user model
LIBRARY_NAME = xpfc LIBRARY_NAME = xpfc

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

@ -47,6 +47,7 @@
#include "nsViewsCID.h" #include "nsViewsCID.h"
#include "nsPluginsCID.h" #include "nsPluginsCID.h"
#include "nsIDeviceContext.h" #include "nsIDeviceContext.h"
#include "nsINetService.h"
#ifdef NS_WIN32 #ifdef NS_WIN32
#include "direct.h" #include "direct.h"
@ -234,6 +235,7 @@ nsresult nsShellInstance::RegisterFactories()
#define PREF_DLL "xppref32.dll" #define PREF_DLL "xppref32.dll"
#define WEB_DLL "raptorweb.dll" #define WEB_DLL "raptorweb.dll"
#define PLUGIN_DLL "raptorplugin.dll" #define PLUGIN_DLL "raptorplugin.dll"
#define NETLIB_DLL "netlib.dll"
#else #else
#define GFXWIN_DLL "libgfxunix.so" #define GFXWIN_DLL "libgfxunix.so"
#define WIDGET_DLL "libwidgetunix.so" #define WIDGET_DLL "libwidgetunix.so"
@ -242,6 +244,7 @@ nsresult nsShellInstance::RegisterFactories()
#define PREF_DLL "libpref.so" #define PREF_DLL "libpref.so"
#define WEB_DLL "libraptorweb.so" #define WEB_DLL "libraptorweb.so"
#define PLUGIN_DLL "raptorplugin.so" #define PLUGIN_DLL "raptorplugin.so"
#define NETLIB_DLL "netlib.so"
#endif #endif
@ -254,6 +257,7 @@ nsresult nsShellInstance::RegisterFactories()
static NS_DEFINE_IID(kCFontMetricsIID, NS_FONT_METRICS_CID); static NS_DEFINE_IID(kCFontMetricsIID, NS_FONT_METRICS_CID);
static NS_DEFINE_IID(kCImageIID, NS_IMAGE_CID); static NS_DEFINE_IID(kCImageIID, NS_IMAGE_CID);
static NS_DEFINE_IID(kCRegionIID, NS_REGION_CID); static NS_DEFINE_IID(kCRegionIID, NS_REGION_CID);
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
nsRepository::RegisterFactory(kCRenderingContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE); nsRepository::RegisterFactory(kCRenderingContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCDeviceContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE); nsRepository::RegisterFactory(kCDeviceContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
@ -315,6 +319,8 @@ nsresult nsShellInstance::RegisterFactories()
nsRepository::RegisterFactory(kCViewCID, VIEW_DLL, PR_FALSE, PR_FALSE); nsRepository::RegisterFactory(kCViewCID, VIEW_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCScrollingViewCID, VIEW_DLL, PR_FALSE, PR_FALSE); nsRepository::RegisterFactory(kCScrollingViewCID, VIEW_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kNetServiceCID, NETLIB_DLL, PR_FALSE, PR_FALSE);
return NS_OK; return NS_OK;
} }