From 64c1df8ee4b8d7958a0859cbd4e9e39470ff03fd Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Thu, 21 Jan 1999 01:56:05 +0000 Subject: [PATCH] new xul directory git-svn-id: svn://10.0.0.236/trunk@18124 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/shared/public/nsXULAtoms.h | 56 +++++++++++++ mozilla/content/shared/src/nsXULAtoms.cpp | 78 +++++++++++++++++++ mozilla/layout/xul/Makefile.in | 29 +++++++ mozilla/layout/xul/content/Makefile.in | 29 +++++++ mozilla/layout/xul/content/makefile.win | 22 ++++++ mozilla/layout/xul/content/src/Makefile.in | 64 +++++++++++++++ mozilla/layout/xul/content/src/makefile.win | 53 +++++++++++++ mozilla/layout/xul/content/src/nsXULAtoms.cpp | 78 +++++++++++++++++++ mozilla/layout/xul/content/src/nsXULAtoms.h | 56 +++++++++++++ mozilla/layout/xul/makefile.win | 22 ++++++ 10 files changed, 487 insertions(+) create mode 100644 mozilla/content/shared/public/nsXULAtoms.h create mode 100644 mozilla/content/shared/src/nsXULAtoms.cpp create mode 100644 mozilla/layout/xul/Makefile.in create mode 100644 mozilla/layout/xul/content/Makefile.in create mode 100644 mozilla/layout/xul/content/makefile.win create mode 100644 mozilla/layout/xul/content/src/Makefile.in create mode 100644 mozilla/layout/xul/content/src/makefile.win create mode 100644 mozilla/layout/xul/content/src/nsXULAtoms.cpp create mode 100644 mozilla/layout/xul/content/src/nsXULAtoms.h create mode 100644 mozilla/layout/xul/makefile.win diff --git a/mozilla/content/shared/public/nsXULAtoms.h b/mozilla/content/shared/public/nsXULAtoms.h new file mode 100644 index 00000000000..c1c2b251b79 --- /dev/null +++ b/mozilla/content/shared/public/nsXULAtoms.h @@ -0,0 +1,56 @@ +/* -*- 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 nsXULAtoms_h___ +#define nsXULAtoms_h___ + +#include "prtypes.h" +#include "nsIAtom.h" + +class nsINameSpaceManager; + +/** + * This class wraps up the creation and destruction of the standard + * set of xul atoms used during normal xul handling. This object + * is created when the first xul content object is created, and + * destroyed when the last such content object is destroyed. + */ +class nsXULAtoms { +public: + + static void AddrefAtoms(); + static void ReleaseAtoms(); + + // XUL namespace ID, good for the life of the nsXULAtoms object + static PRInt32 nameSpaceID; + + // Alphabetical list of xul tag and attribute atoms + static nsIAtom* button; + + static nsIAtom* checkbox; + + static nsIAtom* radio; + + static nsIAtom* text; + static nsIAtom* toolbar; + static nsIAtom* tree; + + static nsIAtom* widget; + static nsIAtom* window; +}; + +#endif /* nsXULAtoms_h___ */ diff --git a/mozilla/content/shared/src/nsXULAtoms.cpp b/mozilla/content/shared/src/nsXULAtoms.cpp new file mode 100644 index 00000000000..5546a9a5c7c --- /dev/null +++ b/mozilla/content/shared/src/nsXULAtoms.cpp @@ -0,0 +1,78 @@ +/* -*- 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 "nsString.h" +#include "nsINameSpaceManager.h" +#include "nsXULAtoms.h" + +static const char kXULNameSpace[] = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; + +// XXX make this be autogenerated. doh! + +PRInt32 nsXULAtoms::nameSpaceID; +nsIAtom* nsXULAtoms::button; +nsIAtom* nsXULAtoms::checkbox; +nsIAtom* nsXULAtoms::radio; +nsIAtom* nsXULAtoms::text; +nsIAtom* nsXULAtoms::toolbar; +nsIAtom* nsXULAtoms::tree; +nsIAtom* nsXULAtoms::widget; +nsIAtom* nsXULAtoms::window; + +static nsrefcnt gRefCnt; +static nsINameSpaceManager* gNameSpaceManager; + +void nsXULAtoms::AddrefAtoms() { + + if (gRefCnt == 0) { + /* XUL Atoms registers the XUL name space ID because it's a convenient + place to do this, if you don't want a permanent, "well-known" ID. + */ + if (NS_SUCCEEDED(NS_NewNameSpaceManager(&gNameSpaceManager))) +// gNameSpaceManager->CreateRootNameSpace(namespace); + gNameSpaceManager->RegisterNameSpace(kXULNameSpace, nameSpaceID); + else + NS_ASSERTION(0, "failed to create xul atoms namespace manager"); + + // now register the atoms + button = NS_NewAtom("button"); + checkbox = NS_NewAtom("checkbox"); + radio = NS_NewAtom("radio"); + text = NS_NewAtom("text"); + toolbar = NS_NewAtom("toolbar"); + tree = NS_NewAtom("tree"); + window = NS_NewAtom("widget"); + window = NS_NewAtom("window"); + } + ++gRefCnt; +} + +void nsXULAtoms::ReleaseAtoms() { + + NS_PRECONDITION(gRefCnt != 0, "bad release of xul atoms"); + if (--gRefCnt == 0) { + NS_RELEASE(button); + NS_RELEASE(checkbox); + NS_RELEASE(radio); + NS_RELEASE(text); + NS_RELEASE(toolbar); + NS_RELEASE(tree); + NS_RELEASE(window); + NS_IF_RELEASE(gNameSpaceManager); + } +} diff --git a/mozilla/layout/xul/Makefile.in b/mozilla/layout/xul/Makefile.in new file mode 100644 index 00000000000..ba2c51945de --- /dev/null +++ b/mozilla/layout/xul/Makefile.in @@ -0,0 +1,29 @@ +#!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 = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +DIRS = content + +include $(topsrcdir)/config/config.mk + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/layout/xul/content/Makefile.in b/mozilla/layout/xul/content/Makefile.in new file mode 100644 index 00000000000..586e96d7d1a --- /dev/null +++ b/mozilla/layout/xul/content/Makefile.in @@ -0,0 +1,29 @@ +#!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 = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +DIRS = src + +include $(topsrcdir)/config/config.mk + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/layout/xul/content/makefile.win b/mozilla/layout/xul/content/makefile.win new file mode 100644 index 00000000000..c60dddaa76c --- /dev/null +++ b/mozilla/layout/xul/content/makefile.win @@ -0,0 +1,22 @@ +#!nmake +# +# 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=..\..\.. + +DIRS=src + +include <$(DEPTH)\layout\config\rules.mak> diff --git a/mozilla/layout/xul/content/src/Makefile.in b/mozilla/layout/xul/content/src/Makefile.in new file mode 100644 index 00000000000..5282e0ccc6b --- /dev/null +++ b/mozilla/layout/xul/content/src/Makefile.in @@ -0,0 +1,64 @@ +#!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=../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +include $(topsrcdir)/config/config.mk + +LIBRARY_NAME = raptorxulcontent_s + +DEFINES += -D_IMPL_NS_HTML + +INCLUDES += \ + -I$(srcdir)/../../../base/src \ + -I$(DIST)/public/raptor \ + $(NULL) + +# Note the sophisticated alphabetical ordering :-| +CPPSRCS = \ + nsXULAtoms.cpp \ + $(NULL) + +EXPORTS = \ + $(NULL) + +EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) + +MODULE=layout + +REQUIRES = xpcom raptor dom + +MKSHLIB := + +# we don't want the shared lib +NO_SHARED_LIB=1 + +include $(topsrcdir)/config/rules.mk + + +export:: + +install:: $(TARGETS) + + +clobber:: + diff --git a/mozilla/layout/xul/content/src/makefile.win b/mozilla/layout/xul/content/src/makefile.win new file mode 100644 index 00000000000..6ee10e77130 --- /dev/null +++ b/mozilla/layout/xul/content/src/makefile.win @@ -0,0 +1,53 @@ +#!nmake +# +# 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=..\..\..\.. + +LIBRARY_NAME=raptorxulcontent_s +MODULE=raptor +REQUIRES=xpcom raptor pref + +DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN + +CPPSRCS= \ + nsXULAtoms.cpp \ + $(NULL) + +CPP_OBJS= \ + .\$(OBJDIR)\nsXULAtoms.obj \ + $(NULL) + +EXPORTS = \ + $(NULL) + +LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \ + -I..\..\..\html\style\src -I..\..\..\html\base\src -I$(PUBLIC)\dom \ + -I..\..\..\html\document\src \ + -I$(PUBLIC)\netlib -I..\..\..\base\src -I$(PUBLIC)\pref + +LCFLAGS = \ + $(LCFLAGS) \ + $(DEFINES) \ + $(NULL) + +include <$(DEPTH)\layout\config\rules.mak> + +libs:: $(LIBRARY) + $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib + +clobber:: + rm -f $(DIST)\lib\$(LIBRARY_NAME).lib diff --git a/mozilla/layout/xul/content/src/nsXULAtoms.cpp b/mozilla/layout/xul/content/src/nsXULAtoms.cpp new file mode 100644 index 00000000000..5546a9a5c7c --- /dev/null +++ b/mozilla/layout/xul/content/src/nsXULAtoms.cpp @@ -0,0 +1,78 @@ +/* -*- 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 "nsString.h" +#include "nsINameSpaceManager.h" +#include "nsXULAtoms.h" + +static const char kXULNameSpace[] = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; + +// XXX make this be autogenerated. doh! + +PRInt32 nsXULAtoms::nameSpaceID; +nsIAtom* nsXULAtoms::button; +nsIAtom* nsXULAtoms::checkbox; +nsIAtom* nsXULAtoms::radio; +nsIAtom* nsXULAtoms::text; +nsIAtom* nsXULAtoms::toolbar; +nsIAtom* nsXULAtoms::tree; +nsIAtom* nsXULAtoms::widget; +nsIAtom* nsXULAtoms::window; + +static nsrefcnt gRefCnt; +static nsINameSpaceManager* gNameSpaceManager; + +void nsXULAtoms::AddrefAtoms() { + + if (gRefCnt == 0) { + /* XUL Atoms registers the XUL name space ID because it's a convenient + place to do this, if you don't want a permanent, "well-known" ID. + */ + if (NS_SUCCEEDED(NS_NewNameSpaceManager(&gNameSpaceManager))) +// gNameSpaceManager->CreateRootNameSpace(namespace); + gNameSpaceManager->RegisterNameSpace(kXULNameSpace, nameSpaceID); + else + NS_ASSERTION(0, "failed to create xul atoms namespace manager"); + + // now register the atoms + button = NS_NewAtom("button"); + checkbox = NS_NewAtom("checkbox"); + radio = NS_NewAtom("radio"); + text = NS_NewAtom("text"); + toolbar = NS_NewAtom("toolbar"); + tree = NS_NewAtom("tree"); + window = NS_NewAtom("widget"); + window = NS_NewAtom("window"); + } + ++gRefCnt; +} + +void nsXULAtoms::ReleaseAtoms() { + + NS_PRECONDITION(gRefCnt != 0, "bad release of xul atoms"); + if (--gRefCnt == 0) { + NS_RELEASE(button); + NS_RELEASE(checkbox); + NS_RELEASE(radio); + NS_RELEASE(text); + NS_RELEASE(toolbar); + NS_RELEASE(tree); + NS_RELEASE(window); + NS_IF_RELEASE(gNameSpaceManager); + } +} diff --git a/mozilla/layout/xul/content/src/nsXULAtoms.h b/mozilla/layout/xul/content/src/nsXULAtoms.h new file mode 100644 index 00000000000..c1c2b251b79 --- /dev/null +++ b/mozilla/layout/xul/content/src/nsXULAtoms.h @@ -0,0 +1,56 @@ +/* -*- 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 nsXULAtoms_h___ +#define nsXULAtoms_h___ + +#include "prtypes.h" +#include "nsIAtom.h" + +class nsINameSpaceManager; + +/** + * This class wraps up the creation and destruction of the standard + * set of xul atoms used during normal xul handling. This object + * is created when the first xul content object is created, and + * destroyed when the last such content object is destroyed. + */ +class nsXULAtoms { +public: + + static void AddrefAtoms(); + static void ReleaseAtoms(); + + // XUL namespace ID, good for the life of the nsXULAtoms object + static PRInt32 nameSpaceID; + + // Alphabetical list of xul tag and attribute atoms + static nsIAtom* button; + + static nsIAtom* checkbox; + + static nsIAtom* radio; + + static nsIAtom* text; + static nsIAtom* toolbar; + static nsIAtom* tree; + + static nsIAtom* widget; + static nsIAtom* window; +}; + +#endif /* nsXULAtoms_h___ */ diff --git a/mozilla/layout/xul/makefile.win b/mozilla/layout/xul/makefile.win new file mode 100644 index 00000000000..bd8f59cf21e --- /dev/null +++ b/mozilla/layout/xul/makefile.win @@ -0,0 +1,22 @@ +#!nmake +# +# 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=..\.. + +DIRS = content + +include <$(DEPTH)\layout\config\rules.mak>