WIP: XP USer class

This commit is contained in:
spider@netscape.com
1998-09-15 17:29:04 +00:00
parent bc6d143236
commit 6440f7cc77
19 changed files with 558 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ AR_LIBS += \
util \
toolkit \
widget \
xpfc_user \
$(NULL)
OS_LIBS += $(GUI_LIBS) $(MATH_LIB)

View File

@@ -47,6 +47,11 @@
{ 0xcd5cd8b0, 0x3b80, 0x11d2, \
{0xbe, 0xe0, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
// f156ec60-4cba-11d2-924a-00805f8a7ab6
#define NS_USER_CID \
{ 0xf156ec60, 0x4cba, 0x11d2, \
{0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
// 55395780-3b98-11d2-bee0-00805f8a8dbd
#define NS_XPFC_BUTTON_CID \
{ 0x55395780, 0x3b98, 0x11d2, \

View File

@@ -60,6 +60,7 @@
#include "nsCommandServer.h"
#include "nsXPFCHTMLCanvas.h"
#include "nsXPFolderCanvas.h"
#include "nsUser.h"
static NS_DEFINE_IID(kCShellInstance, NS_XPFC_SHELL_INSTANCE_CID);
static NS_DEFINE_IID(kCMenuItem, NS_MENUITEM_CID);
@@ -101,6 +102,7 @@ static NS_DEFINE_IID(kCStack, NS_STACK_CID);
static NS_DEFINE_IID(kCXPFCMethodInvokerCommand, NS_XPFC_METHODINVOKER_COMMAND_CID);
static NS_DEFINE_IID(kCXPFCCommandServerCID, NS_XPFC_COMMAND_SERVER_CID);
static NS_DEFINE_IID(kCXPFCActionCommand, NS_XPFC_ACTION_COMMAND_CID);
static NS_DEFINE_IID(kCUserCID, NS_USER_CID);
class nsxpfcFactory : public nsIFactory
{

View File

@@ -101,6 +101,8 @@ nsresult nsxpfcFactory::CreateInstance(nsISupports *aOuter,
inst = (nsISupports *)(nsIXPFCToolbar *)new nsXPFCToolbar(aOuter);
} else if (mClassID.Equals(kCXPFCDialog)) {
inst = (nsISupports *)(nsIXPFCDialog *)new nsXPFCDialog(aOuter);
} else if (mClassID.Equals(kCUserCID)) {
inst = (nsISupports *)(nsIUser *)new nsUser(aOuter);
} else if (mClassID.Equals(kCXPFCButton)) {
inst = (nsISupports *)(nsIXPFCButton *)new nsXPFCButton(aOuter);
} else if (mClassID.Equals(kCXPButton)) {

View File

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

View File

@@ -46,6 +46,7 @@ static NS_DEFINE_IID(kCMenuManagerCID, NS_MENU_MANAGER_CID);
static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID);
static NS_DEFINE_IID(kCXPFCToolbarCID, NS_XPFC_TOOLBAR_CID);
static NS_DEFINE_IID(kCXPFCDialogCID, NS_XPFC_DIALOG_CID);
static NS_DEFINE_IID(kCUserCID, NS_USER_CID);
static NS_DEFINE_IID(kCXPFCButtonCID, NS_XPFC_BUTTON_CID);
static NS_DEFINE_IID(kCXPButtonCID, NS_XP_BUTTON_CID);
static NS_DEFINE_IID(kCXPItemCID, NS_XP_ITEM_CID);
@@ -101,6 +102,7 @@ void main(int argc, char **argv)
nsRepository::RegisterFactory(kCXPItemCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCBoxLayoutCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCListLayoutCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCUserCID, XPFC_DLL, PR_FALSE, PR_FALSE);
result = nsRepository::CreateInstance(kCShellInstanceCID,
NULL,

View File

@@ -46,6 +46,7 @@ static NS_DEFINE_IID(kCMenuManagerCID, NS_MENU_MANAGER_CID);
static NS_DEFINE_IID(kCXPFCToolbarCID, NS_XPFC_TOOLBAR_CID);
static NS_DEFINE_IID(kCXPFCDialogCID, NS_XPFC_DIALOG_CID);
static NS_DEFINE_IID(kCUserCID, NS_USER_CID);
static NS_DEFINE_IID(kCXPFCButtonCID, NS_XPFC_BUTTON_CID);
static NS_DEFINE_IID(kCXPButtonCID, NS_XP_BUTTON_CID);
static NS_DEFINE_IID(kCXPItemCID, NS_XP_ITEM_CID);
@@ -80,6 +81,7 @@ int PASCAL WinMain(HANDLE instance, HANDLE prevInstance, LPSTR cmdParam, int nCm
nsRepository::RegisterFactory(kCMenuItemCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCToolbarCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCDialogCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCUserCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCButtonCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPButtonCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPItemCID, XPFC_DLL, PR_FALSE, PR_FALSE);

53
xpfc/user/Makefile Normal file
View File

@@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright <20> 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). #
#######################################################################

53
xpfc/user/inc/Makefile Normal file
View File

@@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright <20> 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). #
#######################################################################

21
xpfc/user/inc/manifest.mn Normal file
View File

@@ -0,0 +1,21 @@
#
# 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 = \
nsUser.h \
$(NULL)
MODULE = xpfc
REQUIRES = raptor

48
xpfc/user/inc/nsUser.h Normal file
View File

@@ -0,0 +1,48 @@
/* -*- 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 nsUser_h___
#define nsUser_h___
#include "nsIUser.h"
class nsUser : public nsIUser
{
public:
nsUser(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD GetUserName(nsString& aUserName);
NS_IMETHOD SetUserName(nsString& aUserName);
NS_IMETHOD GetUserField(nsUserField aUserField, nsString& aUserValue);
NS_IMETHOD SetUserField(nsUserField aUserField, nsString& aUserValue);
protected:
~nsUser();
private:
nsString mUserName;
};
#endif /* nsUser_h___ */

15
xpfc/user/manifest.mn Normal file
View File

@@ -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

53
xpfc/user/public/Makefile Normal file
View File

@@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright <20> 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). #
#######################################################################

View File

@@ -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 = \
nsIUser.h \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = xpfc
REQUIRES = raptor

View File

@@ -0,0 +1,53 @@
/* -*- 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 nsIUser_h___
#define nsIUser_h___
#include "nsISupports.h"
#include "nsString.h"
//5695c240-4cb8-11d2-924a-00805f8a7ab6
#define NS_IUSER_IID \
{ 0x5695c240, 0x4cb8, 0x11d2, \
{0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
enum nsUserField {
nsUserField_username,
nsUserField_emailaddress,
nsUserField_displayname
};
class nsIUser : public nsISupports
{
public:
NS_IMETHOD Init() = 0;
NS_IMETHOD GetUserName(nsString& aUserName) = 0;
NS_IMETHOD SetUserName(nsString& aUserName) = 0;
NS_IMETHOD GetUserField(nsUserField aUserField, nsString& aUserValue) = 0;
NS_IMETHOD SetUserField(nsUserField aUserField, nsString& aUserValue) = 0;
};
#endif /* nsIUser_h___ */

53
xpfc/user/src/Makefile Normal file
View File

@@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright <20> 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). #
#######################################################################

24
xpfc/user/src/config.mk Normal file
View File

@@ -0,0 +1,24 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright <20> 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_XPFC -DNSPR20
INCLUDES += -I../inc -I$(GDEPTH)/include
LIBRARY_NAME = xpfc_user
LIBRARY_VERSION = 10
ARCHIVE_ONLY = 1
TARGETS = $(LIBRARY)

25
xpfc/user/src/manifest.mn Normal file
View File

@@ -0,0 +1,25 @@
#
# 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 = xpfc
CPPSRCS = \
nsUser.cpp \
$(NULL)
REQUIRES = xpcom raptor netlib

123
xpfc/user/src/nsUser.cpp Normal file
View File

@@ -0,0 +1,123 @@
/* -*- 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 "nsUser.h"
#include "nsxpfcCIID.h"
#include "nspr.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCUserCID, NS_USER_CID);
static NS_DEFINE_IID(kCIUserIID, NS_IUSER_IID);
nsUser :: nsUser(nsISupports* outer)
{
NS_INIT_REFCNT();
mUserName = "";
}
nsUser :: ~nsUser()
{
}
nsresult nsUser::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCUserCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) (nsUser *)this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kCIUserIID)) {
*aInstancePtr = (void*) (nsIUser *)this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (NS_ERROR_NO_INTERFACE);
}
NS_IMPL_ADDREF(nsUser)
NS_IMPL_RELEASE(nsUser)
nsresult nsUser :: Init()
{
return NS_OK;
}
nsresult nsUser :: GetUserName(nsString& aUserName)
{
GetUserField(nsUserField_username, aUserName);
return NS_OK;
}
nsresult nsUser :: SetUserName(nsString& aUserName)
{
SetUserField(nsUserField_username, aUserName);
return NS_OK;
}
nsresult nsUser :: GetUserField(nsUserField aUserField, nsString& aUserValue)
{
switch(aUserField)
{
case nsUserField_username:
aUserValue = mUserName ;
break;
case nsUserField_emailaddress:
break;
case nsUserField_displayname:
break;
default:
break;
}
return NS_OK;
}
nsresult nsUser :: SetUserField(nsUserField aUserField, nsString& aUserValue)
{
switch(aUserField)
{
case nsUserField_username:
mUserName = aUserValue ;
break;
case nsUserField_emailaddress:
break;
case nsUserField_displayname:
break;
default:
break;
}
return NS_OK;
}