Removing obsolete files from the build.

This commit is contained in:
hyatt%netscape.com 2000-05-30 08:11:35 +00:00
Родитель c8bc84a0a3
Коммит b962248eca
23 изменённых файлов: 160 добавлений и 2992 удалений

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

@ -111,11 +111,9 @@
#include "nsXULEditorElement.h"
#include "nsXULTreeElement.h"
#include "nsXULPopupElement.h"
#include "nsXULTitledButtonElement.h"
#include "nsXULCheckboxElement.h"
#include "nsXULRadioElement.h"
#include "nsXULRadioGroupElement.h"
#include "nsXULMenuListElement.h"
#include "nsIBoxObject.h"
#include "nsPIBoxObject.h"
#include "nsXULDocument.h"
// Used for the temporary DOM Level2 hack
@ -308,7 +306,6 @@ nsIAtom* nsXULElement::kMenuPopupAtom;
nsIAtom* nsXULElement::kRefAtom;
nsIAtom* nsXULElement::kSelectedAtom;
nsIAtom* nsXULElement::kStyleAtom;
nsIAtom* nsXULElement::kTitledButtonAtom;
nsIAtom* nsXULElement::kTooltipAtom;
nsIAtom* nsXULElement::kTreeAtom;
nsIAtom* nsXULElement::kTreeCellAtom;
@ -322,12 +319,9 @@ nsIAtom* nsXULElement::kBrowserAtom;
nsIAtom* nsXULElement::kEditorAtom;
nsIAtom* nsXULElement::kWidthAtom;
nsIAtom* nsXULElement::kWindowAtom;
nsIAtom* nsXULElement::kCheckboxAtom;
nsIAtom* nsXULElement::kRadioAtom;
nsIAtom* nsXULElement::kRadioGroupAtom;
nsIAtom* nsXULElement::kMenuListAtom;
nsIAtom* nsXULElement::kMenuButtonAtom;
nsIAtom* nsXULElement::kTextFieldAtom;
nsIAtom* nsXULElement::kMenuAtom;
nsIAtom* nsXULElement::kPopupSetAtom;
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
PRUint32 nsXULPrototypeAttribute::gNumElements;
@ -392,7 +386,6 @@ nsXULElement::Init()
kRefAtom = NS_NewAtom("ref");
kSelectedAtom = NS_NewAtom("selected");
kStyleAtom = NS_NewAtom("style");
kTitledButtonAtom = NS_NewAtom("titledbutton");
kTooltipAtom = NS_NewAtom("tooltip");
kTreeAtom = NS_NewAtom("tree");
kTreeCellAtom = NS_NewAtom("treecell");
@ -406,13 +399,10 @@ nsXULElement::Init()
kEditorAtom = NS_NewAtom("editor");
kWidthAtom = NS_NewAtom("width");
kWindowAtom = NS_NewAtom("window");
kCheckboxAtom = NS_NewAtom("checkbox");
kRadioAtom = NS_NewAtom("radio");
kRadioGroupAtom = NS_NewAtom("radiogroup");
kMenuListAtom = NS_NewAtom("menulist");
kMenuButtonAtom = NS_NewAtom("menubutton");
kTextFieldAtom = NS_NewAtom("textfield");
kMenuAtom = NS_NewAtom("menu");
kPopupSetAtom = NS_NewAtom("popupset");
rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
nsnull,
kINameSpaceManagerIID,
@ -476,7 +466,6 @@ nsXULElement::~nsXULElement()
NS_IF_RELEASE(kRefAtom);
NS_IF_RELEASE(kSelectedAtom);
NS_IF_RELEASE(kStyleAtom);
NS_IF_RELEASE(kTitledButtonAtom);
NS_IF_RELEASE(kTooltipAtom);
NS_IF_RELEASE(kTreeAtom);
NS_IF_RELEASE(kTreeCellAtom);
@ -490,12 +479,9 @@ nsXULElement::~nsXULElement()
NS_IF_RELEASE(kEditorAtom);
NS_IF_RELEASE(kWidthAtom);
NS_IF_RELEASE(kWindowAtom);
NS_IF_RELEASE(kCheckboxAtom);
NS_IF_RELEASE(kRadioAtom);
NS_IF_RELEASE(kRadioGroupAtom);
NS_IF_RELEASE(kMenuListAtom);
NS_IF_RELEASE(kMenuButtonAtom);
NS_IF_RELEASE(kTextFieldAtom);
NS_IF_RELEASE(kMenuAtom);
NS_IF_RELEASE(kPopupSetAtom);
NS_IF_RELEASE(gNameSpaceManager);
@ -767,90 +753,6 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULTitledButtonElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kTitledButtonAtom) {
// We delegate XULTitledButtonElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULTitledButtonElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULCheckboxElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kCheckboxAtom) {
// We delegate XULCheckboxElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULCheckboxElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULRadioElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kRadioAtom) {
// We delegate XULRadioElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULRadioElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULRadioGroupElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kRadioGroupAtom) {
// We delegate XULRadioElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULRadioGroupElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULEditorElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
@ -2209,22 +2111,6 @@ nsXULElement::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject)
fn = NS_NewScriptXULBrowserElement;
rootname = "nsXULBrowserElement::mScriptObject";
}
else if (tag.get() == kTitledButtonAtom) {
fn = NS_NewScriptXULTitledButtonElement;
rootname = "nsXULTitledButtonElement::mScriptObject";
}
else if (tag.get() == kCheckboxAtom) {
fn = NS_NewScriptXULCheckboxElement;
rootname = "nsXULCheckboxElement::mScriptObject";
}
else if (tag.get() == kRadioAtom) {
fn = NS_NewScriptXULRadioElement;
rootname = "nsXULRadioElement::mScriptObject";
}
else if (tag.get() == kRadioGroupAtom) {
fn = NS_NewScriptXULRadioGroupElement;
rootname = "nsXULRadioGroupElement::mScriptObject";
}
else if (tag.get() == kMenuListAtom) {
fn = NS_NewScriptXULMenuListElement;
rootname = "nsXULMenuListElement::mScriptObject";
@ -2495,6 +2381,12 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileE
mDocument = aDocument; // not refcounted
if (mBoxObject) {
nsCOMPtr<nsPIBoxObject> privateBox(do_QueryInterface(mBoxObject));
if (privateBox)
privateBox->SetDocument(mDocument);
}
if (mDocument) {
// Add a named reference to the script object.
if (mScriptObject) {
@ -4294,49 +4186,55 @@ nsXULElement::GetControllers(nsIControllers** aResult)
return NS_OK;
}
nsresult
nsXULElement::GetAnonymousContent(nsIDOMNodeList** aResult)
NS_IMETHODIMP
nsXULElement::GetBoxObject(nsIBoxObject** aResult)
{
nsresult rv;
nsRDFDOMNodeList* elements;
// Addref happens on following line in the Create call.
if (NS_FAILED(rv = nsRDFDOMNodeList::Create(&elements))) {
NS_ERROR("unable to create node list");
return rv;
if (mBoxObject) {
*aResult = mBoxObject;
NS_ADDREF(*aResult);
return NS_OK;
}
*aResult = elements;
// Use the XBL service to get a content list.
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
if (!xblService)
return rv;
// Retrieve the anonymous content that we should build.
nsCOMPtr<nsISupportsArray> anonymousItems;
nsCOMPtr<nsIContent> childElement;
PRBool dummy;
xblService->GetContentList(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(anonymousItems),
getter_AddRefs(childElement), &dummy);
if (!anonymousItems)
// We need to create our object.
*aResult = nsnull;
if (!mDocument)
return NS_OK;
PRUint32 count = 0;
anonymousItems->Count(&count);
nsCOMPtr<nsIPresShell> shell = getter_AddRefs(mDocument->GetShellAt(0));
if (!shell)
return NS_OK;
for (PRUint32 i=0; i < count; i++)
{
// get our child's content and set its parent to our content
nsCOMPtr<nsISupports> node;
anonymousItems->GetElementAt(i,getter_AddRefs(node));
nsresult rv;
PRInt32 dummy;
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
nsCAutoString progID("component://netscape/layout/xul-boxobject");
if (tag.get() == kBrowserAtom)
progID += "-browser";
else if (tag.get() == kEditorAtom)
progID += "-editor";
else if (tag.get() == kIFrameAtom)
progID += "-iframe";
else if (tag.get() == kMenuAtom)
progID += "-menu";
else if (tag.get() == kPopupSetAtom)
progID += "-popupset";
else if (tag.get() == kTreeAtom)
progID += "-tree";
nsCOMPtr<nsIDOMNode> content(do_QueryInterface(node));
if (content)
elements->AppendNode(content);
}
mBoxObject = do_CreateInstance(progID);
if (mBoxObject)
return NS_OK;
nsCOMPtr<nsPIBoxObject> privateBox(do_QueryInterface(mBoxObject));
if (NS_FAILED(rv = privateBox->Init(NS_STATIC_CAST(nsIStyledContent*, this), shell)))
return rv;
*aResult = mBoxObject;
NS_ADDREF(*aResult);
return NS_OK;
}
@ -4459,7 +4357,7 @@ nsXULElement::Click()
nsCOMPtr<nsIPresShell> shell; // Strong
nsCOMPtr<nsIPresContext> context;
nsAutoString tagName;
PRBool isButton = NodeInfo()->Equals(NS_ConvertASCIItoUCS2("titledbutton"));
PRBool isButton = NodeInfo()->Equals(NS_ConvertASCIItoUCS2("button"));
for (PRInt32 i=0; i<numShells; i++) {
shell = getter_AddRefs(doc->GetShellAt(i));

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

@ -59,6 +59,7 @@
#include "nsIURI.h"
#include "nsIXMLContent.h"
#include "nsIXULContent.h"
#include "nsIBoxObject.h"
#include "nsXULAttributes.h"
#include "nsIChromeEventHandler.h"
@ -343,10 +344,7 @@ protected:
static nsIAtom* kRefAtom;
static nsIAtom* kSelectedAtom;
static nsIAtom* kStyleAtom;
static nsIAtom* kTitledButtonAtom;
static nsIAtom* kCheckboxAtom;
static nsIAtom* kRadioAtom;
static nsIAtom* kRadioGroupAtom;
static nsIAtom* kTooltipAtom;
static nsIAtom* kTreeAtom;
static nsIAtom* kTreeCellAtom;
@ -360,9 +358,9 @@ protected:
static nsIAtom* kEditorAtom;
static nsIAtom* kWidthAtom;
static nsIAtom* kWindowAtom;
static nsIAtom* kMenuButtonAtom;
static nsIAtom* kMenuListAtom;
static nsIAtom* kTextFieldAtom;
static nsIAtom* kMenuAtom;
static nsIAtom* kPopupSetAtom;
public:
static nsresult
@ -569,6 +567,9 @@ protected:
// Whether or not we're anonymous
PRBool mIsAnonymous;
// Our primary layout object (a wrapper for the Gecko "frame" object)
nsCOMPtr<nsIBoxObject> mBoxObject; // [OWNER]
// Lazily instantiated if/when object is mutated. Instantiating
// the mSlots makes an nsXULElement 'heavyweight'.
struct Slots {

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

@ -34,6 +34,7 @@
#include "nsXULAtoms.h"
#include "nsIDOMElement.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNSDocument.h"
#include "nsIXULPopupListener.h"
#include "nsIDOMMouseListener.h"
#include "nsIDOMMouseMotionListener.h"
@ -474,9 +475,10 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
if (popup)
popupContent = do_QueryInterface(popup);
} else {
nsCOMPtr<nsIDOMNSDocument> nsDoc(do_QueryInterface(xulDocument));
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(content));
nsCOMPtr<nsIDOMNodeList> list;
xulElement->GetAnonymousContent(getter_AddRefs(list));
nsDoc->GetAnonymousNodes(xulElement, getter_AddRefs(list));
if (list) {
PRUint32 ctr,listLength;
nsCOMPtr<nsIDOMNode> node;

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

@ -40,8 +40,9 @@
#include "nsIDOMXULElement.h"
#include "nsIXULTemplateBuilder.h"
#include "nsIRDFResource.h"
#include "nsIDOMNodeList.h"
#include "nsIBoxObject.h"
#include "nsIControllers.h"
#include "nsIDOMNodeList.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
@ -53,8 +54,9 @@ static NS_DEFINE_IID(kIRDFCompositeDataSourceIID, NS_IRDFCOMPOSITEDATASOURCE_IID
static NS_DEFINE_IID(kIXULElementIID, NS_IDOMXULELEMENT_IID);
static NS_DEFINE_IID(kIXULTemplateBuilderIID, NS_IXULTEMPLATEBUILDER_IID);
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
static NS_DEFINE_IID(kIBoxObjectIID, NS_IBOXOBJECT_IID);
static NS_DEFINE_IID(kIControllersIID, NS_ICONTROLLERS_IID);
static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
//
// XULElement property ids
@ -67,7 +69,7 @@ enum XULElement_slots {
XULELEMENT_BUILDER = -5,
XULELEMENT_RESOURCE = -6,
XULELEMENT_CONTROLLERS = -7,
XULELEMENT_ANONYMOUSCONTENT = -8
XULELEMENT_BOXOBJECT = -8
};
/***********************************************************************/
@ -179,15 +181,15 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case XULELEMENT_ANONYMOUSCONTENT:
case XULELEMENT_BOXOBJECT:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULELEMENT_ANONYMOUSCONTENT, PR_FALSE);
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULELEMENT_BOXOBJECT, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMNodeList* prop;
rv = a->GetAnonymousContent(&prop);
nsIBoxObject* prop;
rv = a->GetBoxObject(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, NS_GET_IID(nsIBoxObject), cx, obj, vp);
}
}
break;
@ -607,7 +609,7 @@ static JSPropertySpec XULElementProperties[] =
{"builder", XULELEMENT_BUILDER, JSPROP_ENUMERATE | JSPROP_READONLY},
{"resource", XULELEMENT_RESOURCE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"controllers", XULELEMENT_CONTROLLERS, JSPROP_ENUMERATE | JSPROP_READONLY},
{"anonymousContent", XULELEMENT_ANONYMOUSCONTENT, JSPROP_ENUMERATE | JSPROP_READONLY},
{"boxObject", XULELEMENT_BOXOBJECT, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

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

@ -42,11 +42,7 @@ CPPSRCS = \
nsJSXULIFrameElement.cpp \
nsJSXULBrowserElement.cpp \
nsJSXULEditorElement.cpp \
nsJSXULTitledButtonElement.cpp \
nsJSXULCheckboxElement.cpp \
nsJSXULRadioElement.cpp \
nsJSXULRadioGroupElement.cpp \
nsJSXULMenuListElement.cpp \
nsJSXULMenuListElement.cpp \
nsRDFDOMNodeList.cpp \
nsRuleNetwork.cpp \
nsXULAtoms.cpp \
@ -68,10 +64,6 @@ CPPSRCS = \
nsXULEditorElement.cpp \
nsXULPrototypeDocument.cpp \
nsXULPrototypeCache.cpp \
nsXULTitledButtonElement.cpp \
nsXULCheckboxElement.cpp \
nsXULRadioElement.cpp \
nsXULRadioGroupElement.cpp \
nsXULMenuListElement.cpp \
$(NULL)

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

@ -50,11 +50,7 @@ CPP_OBJS=\
.\$(OBJDIR)\nsJSXULIFrameElement.obj \
.\$(OBJDIR)\nsJSXULBrowserElement.obj \
.\$(OBJDIR)\nsJSXULEditorElement.obj \
.\$(OBJDIR)\nsJSXULTitledButtonElement.obj \
.\$(OBJDIR)\nsJSXULCheckboxElement.obj \
.\$(OBJDIR)\nsJSXULRadioElement.obj \
.\$(OBJDIR)\nsJSXULRadioGroupElement.obj \
.\$(OBJDIR)\nsJSXULMenuListElement.obj \
.\$(OBJDIR)\nsJSXULMenuListElement.obj \
.\$(OBJDIR)\nsRDFDOMNodeList.obj \
.\$(OBJDIR)\nsXULElement.obj \
.\$(OBJDIR)\nsXULContentUtils.obj \
@ -67,12 +63,8 @@ CPP_OBJS=\
.\$(OBJDIR)\nsXULBrowserElement.obj \
.\$(OBJDIR)\nsXULEditorElement.obj \
.\$(OBJDIR)\nsXULPopupElement.obj \
.\$(OBJDIR)\nsXULTitledButtonElement.obj \
.\$(OBJDIR)\nsXULMenuListElement.obj \
.\$(OBJDIR)\nsXULCheckboxElement.obj \
.\$(OBJDIR)\nsXULRadioElement.obj \
.\$(OBJDIR)\nsXULRadioGroupElement.obj \
$(NULL)
.\$(OBJDIR)\nsXULMenuListElement.obj \
$(NULL)
# XXX we are including layout\html\base\src to get HTML elements
# constructed directly from Raptor. The hope is that this'll

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

@ -1,480 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nsDOMError.h"
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsCOMPtr.h"
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMXULCheckboxElement.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIXULCheckboxElementIID, NS_IDOMXULCHECKBOXELEMENT_IID);
//
// XULCheckboxElement property ids
//
enum XULCheckboxElement_slots {
XULCHECKBOXELEMENT_VALUE = -1,
XULCHECKBOXELEMENT_CROP = -2,
XULCHECKBOXELEMENT_DISABLED = -3,
XULCHECKBOXELEMENT_SRC = -4,
XULCHECKBOXELEMENT_IMGALIGN = -5,
XULCHECKBOXELEMENT_ACCESSKEY = -6,
XULCHECKBOXELEMENT_CHECKED = -7
};
/***********************************************************************/
//
// XULCheckboxElement Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetXULCheckboxElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULCheckboxElement *a = (nsIDOMXULCheckboxElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case XULCHECKBOXELEMENT_VALUE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_VALUE, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetValue(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULCHECKBOXELEMENT_CROP:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_CROP, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetCrop(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULCHECKBOXELEMENT_DISABLED:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_DISABLED, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
PRBool prop;
rv = a->GetDisabled(&prop);
if (NS_SUCCEEDED(rv)) {
*vp = BOOLEAN_TO_JSVAL(prop);
}
}
break;
}
case XULCHECKBOXELEMENT_SRC:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_SRC, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetSrc(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULCHECKBOXELEMENT_IMGALIGN:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_IMGALIGN, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetImgalign(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULCHECKBOXELEMENT_ACCESSKEY:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_ACCESSKEY, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetAccesskey(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULCHECKBOXELEMENT_CHECKED:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_CHECKED, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
PRBool prop;
rv = a->GetChecked(&prop);
if (NS_SUCCEEDED(rv)) {
*vp = BOOLEAN_TO_JSVAL(prop);
}
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
/***********************************************************************/
//
// XULCheckboxElement Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetXULCheckboxElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULCheckboxElement *a = (nsIDOMXULCheckboxElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case XULCHECKBOXELEMENT_VALUE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_VALUE, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetValue(prop);
}
break;
}
case XULCHECKBOXELEMENT_CROP:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_CROP, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetCrop(prop);
}
break;
}
case XULCHECKBOXELEMENT_DISABLED:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_DISABLED, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
PRBool prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
}
rv = a->SetDisabled(prop);
}
break;
}
case XULCHECKBOXELEMENT_SRC:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_SRC, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetSrc(prop);
}
break;
}
case XULCHECKBOXELEMENT_IMGALIGN:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_IMGALIGN, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetImgalign(prop);
}
break;
}
case XULCHECKBOXELEMENT_ACCESSKEY:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_ACCESSKEY, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetAccesskey(prop);
}
break;
}
case XULCHECKBOXELEMENT_CHECKED:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULCHECKBOXELEMENT_CHECKED, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
PRBool prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
}
rv = a->SetChecked(prop);
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
//
// XULCheckboxElement finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeXULCheckboxElement(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// XULCheckboxElement enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateXULCheckboxElement(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// XULCheckboxElement resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveXULCheckboxElement(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
/***********************************************************************/
//
// class for XULCheckboxElement
//
JSClass XULCheckboxElementClass = {
"XULCheckboxElement",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub,
JS_PropertyStub,
GetXULCheckboxElementProperty,
SetXULCheckboxElementProperty,
EnumerateXULCheckboxElement,
ResolveXULCheckboxElement,
JS_ConvertStub,
FinalizeXULCheckboxElement,
nsnull,
nsJSUtils::nsCheckAccess
};
//
// XULCheckboxElement class properties
//
static JSPropertySpec XULCheckboxElementProperties[] =
{
{"value", XULCHECKBOXELEMENT_VALUE, JSPROP_ENUMERATE},
{"crop", XULCHECKBOXELEMENT_CROP, JSPROP_ENUMERATE},
{"disabled", XULCHECKBOXELEMENT_DISABLED, JSPROP_ENUMERATE},
{"src", XULCHECKBOXELEMENT_SRC, JSPROP_ENUMERATE},
{"imgalign", XULCHECKBOXELEMENT_IMGALIGN, JSPROP_ENUMERATE},
{"accesskey", XULCHECKBOXELEMENT_ACCESSKEY, JSPROP_ENUMERATE},
{"checked", XULCHECKBOXELEMENT_CHECKED, JSPROP_ENUMERATE},
{0}
};
//
// XULCheckboxElement class methods
//
static JSFunctionSpec XULCheckboxElementMethods[] =
{
{0}
};
//
// XULCheckboxElement constructor
//
PR_STATIC_CALLBACK(JSBool)
XULCheckboxElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// XULCheckboxElement class initialization
//
extern "C" NS_DOM nsresult NS_InitXULCheckboxElementClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *parent_proto = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
jsval vp;
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "XULCheckboxElement", &vp)) ||
!JSVAL_IS_OBJECT(vp) ||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
!JSVAL_IS_OBJECT(vp)) {
if (NS_OK != NS_InitXULElementClass(aContext, (void **)&parent_proto)) {
return NS_ERROR_FAILURE;
}
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&XULCheckboxElementClass, // JSClass
XULCheckboxElement, // JSNative ctor
0, // ctor args
XULCheckboxElementProperties, // proto props
XULCheckboxElementMethods, // proto funcs
nsnull, // ctor props (static)
nsnull); // ctor funcs (static)
if (nsnull == proto) {
return NS_ERROR_FAILURE;
}
}
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
proto = JSVAL_TO_OBJECT(vp);
}
else {
return NS_ERROR_FAILURE;
}
if (aPrototype) {
*aPrototype = proto;
}
return NS_OK;
}
//
// Method for creating a new XULCheckboxElement JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptXULCheckboxElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULCheckboxElement");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMXULCheckboxElement *aXULCheckboxElement;
if (nsnull == aParent) {
parent = nsnull;
}
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
NS_RELEASE(owner);
return NS_ERROR_FAILURE;
}
NS_RELEASE(owner);
}
else {
return NS_ERROR_FAILURE;
}
if (NS_OK != NS_InitXULCheckboxElementClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIXULCheckboxElementIID, (void **)&aXULCheckboxElement);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &XULCheckboxElementClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULCheckboxElement);
}
else {
NS_RELEASE(aXULCheckboxElement);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

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

@ -40,8 +40,9 @@
#include "nsIDOMXULElement.h"
#include "nsIXULTemplateBuilder.h"
#include "nsIRDFResource.h"
#include "nsIDOMNodeList.h"
#include "nsIBoxObject.h"
#include "nsIControllers.h"
#include "nsIDOMNodeList.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
@ -53,8 +54,9 @@ static NS_DEFINE_IID(kIRDFCompositeDataSourceIID, NS_IRDFCOMPOSITEDATASOURCE_IID
static NS_DEFINE_IID(kIXULElementIID, NS_IDOMXULELEMENT_IID);
static NS_DEFINE_IID(kIXULTemplateBuilderIID, NS_IXULTEMPLATEBUILDER_IID);
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
static NS_DEFINE_IID(kIBoxObjectIID, NS_IBOXOBJECT_IID);
static NS_DEFINE_IID(kIControllersIID, NS_ICONTROLLERS_IID);
static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
//
// XULElement property ids
@ -67,7 +69,7 @@ enum XULElement_slots {
XULELEMENT_BUILDER = -5,
XULELEMENT_RESOURCE = -6,
XULELEMENT_CONTROLLERS = -7,
XULELEMENT_ANONYMOUSCONTENT = -8
XULELEMENT_BOXOBJECT = -8
};
/***********************************************************************/
@ -179,15 +181,15 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case XULELEMENT_ANONYMOUSCONTENT:
case XULELEMENT_BOXOBJECT:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULELEMENT_ANONYMOUSCONTENT, PR_FALSE);
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULELEMENT_BOXOBJECT, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMNodeList* prop;
rv = a->GetAnonymousContent(&prop);
nsIBoxObject* prop;
rv = a->GetBoxObject(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, NS_GET_IID(nsIBoxObject), cx, obj, vp);
}
}
break;
@ -607,7 +609,7 @@ static JSPropertySpec XULElementProperties[] =
{"builder", XULELEMENT_BUILDER, JSPROP_ENUMERATE | JSPROP_READONLY},
{"resource", XULELEMENT_RESOURCE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"controllers", XULELEMENT_CONTROLLERS, JSPROP_ENUMERATE | JSPROP_READONLY},
{"anonymousContent", XULELEMENT_ANONYMOUSCONTENT, JSPROP_ENUMERATE | JSPROP_READONLY},
{"boxObject", XULELEMENT_BOXOBJECT, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

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

@ -1,480 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nsDOMError.h"
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsCOMPtr.h"
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMXULRadioElement.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIXULRadioElementIID, NS_IDOMXULRADIOELEMENT_IID);
//
// XULRadioElement property ids
//
enum XULRadioElement_slots {
XULRADIOELEMENT_VALUE = -1,
XULRADIOELEMENT_CROP = -2,
XULRADIOELEMENT_DISABLED = -3,
XULRADIOELEMENT_SRC = -4,
XULRADIOELEMENT_IMGALIGN = -5,
XULRADIOELEMENT_ACCESSKEY = -6,
XULRADIOELEMENT_CHECKED = -7
};
/***********************************************************************/
//
// XULRadioElement Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetXULRadioElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULRadioElement *a = (nsIDOMXULRadioElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case XULRADIOELEMENT_VALUE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_VALUE, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetValue(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULRADIOELEMENT_CROP:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_CROP, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetCrop(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULRADIOELEMENT_DISABLED:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_DISABLED, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
PRBool prop;
rv = a->GetDisabled(&prop);
if (NS_SUCCEEDED(rv)) {
*vp = BOOLEAN_TO_JSVAL(prop);
}
}
break;
}
case XULRADIOELEMENT_SRC:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_SRC, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetSrc(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULRADIOELEMENT_IMGALIGN:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_IMGALIGN, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetImgalign(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULRADIOELEMENT_ACCESSKEY:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_ACCESSKEY, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetAccesskey(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULRADIOELEMENT_CHECKED:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_CHECKED, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
PRBool prop;
rv = a->GetChecked(&prop);
if (NS_SUCCEEDED(rv)) {
*vp = BOOLEAN_TO_JSVAL(prop);
}
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
/***********************************************************************/
//
// XULRadioElement Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetXULRadioElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULRadioElement *a = (nsIDOMXULRadioElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case XULRADIOELEMENT_VALUE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_VALUE, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetValue(prop);
}
break;
}
case XULRADIOELEMENT_CROP:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_CROP, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetCrop(prop);
}
break;
}
case XULRADIOELEMENT_DISABLED:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_DISABLED, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
PRBool prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
}
rv = a->SetDisabled(prop);
}
break;
}
case XULRADIOELEMENT_SRC:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_SRC, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetSrc(prop);
}
break;
}
case XULRADIOELEMENT_IMGALIGN:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_IMGALIGN, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetImgalign(prop);
}
break;
}
case XULRADIOELEMENT_ACCESSKEY:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_ACCESSKEY, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetAccesskey(prop);
}
break;
}
case XULRADIOELEMENT_CHECKED:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOELEMENT_CHECKED, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
PRBool prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
}
rv = a->SetChecked(prop);
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
//
// XULRadioElement finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeXULRadioElement(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// XULRadioElement enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateXULRadioElement(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// XULRadioElement resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveXULRadioElement(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
/***********************************************************************/
//
// class for XULRadioElement
//
JSClass XULRadioElementClass = {
"XULRadioElement",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub,
JS_PropertyStub,
GetXULRadioElementProperty,
SetXULRadioElementProperty,
EnumerateXULRadioElement,
ResolveXULRadioElement,
JS_ConvertStub,
FinalizeXULRadioElement,
nsnull,
nsJSUtils::nsCheckAccess
};
//
// XULRadioElement class properties
//
static JSPropertySpec XULRadioElementProperties[] =
{
{"value", XULRADIOELEMENT_VALUE, JSPROP_ENUMERATE},
{"crop", XULRADIOELEMENT_CROP, JSPROP_ENUMERATE},
{"disabled", XULRADIOELEMENT_DISABLED, JSPROP_ENUMERATE},
{"src", XULRADIOELEMENT_SRC, JSPROP_ENUMERATE},
{"imgalign", XULRADIOELEMENT_IMGALIGN, JSPROP_ENUMERATE},
{"accesskey", XULRADIOELEMENT_ACCESSKEY, JSPROP_ENUMERATE},
{"checked", XULRADIOELEMENT_CHECKED, JSPROP_ENUMERATE},
{0}
};
//
// XULRadioElement class methods
//
static JSFunctionSpec XULRadioElementMethods[] =
{
{0}
};
//
// XULRadioElement constructor
//
PR_STATIC_CALLBACK(JSBool)
XULRadioElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// XULRadioElement class initialization
//
extern "C" NS_DOM nsresult NS_InitXULRadioElementClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *parent_proto = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
jsval vp;
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "XULRadioElement", &vp)) ||
!JSVAL_IS_OBJECT(vp) ||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
!JSVAL_IS_OBJECT(vp)) {
if (NS_OK != NS_InitXULElementClass(aContext, (void **)&parent_proto)) {
return NS_ERROR_FAILURE;
}
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&XULRadioElementClass, // JSClass
XULRadioElement, // JSNative ctor
0, // ctor args
XULRadioElementProperties, // proto props
XULRadioElementMethods, // proto funcs
nsnull, // ctor props (static)
nsnull); // ctor funcs (static)
if (nsnull == proto) {
return NS_ERROR_FAILURE;
}
}
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
proto = JSVAL_TO_OBJECT(vp);
}
else {
return NS_ERROR_FAILURE;
}
if (aPrototype) {
*aPrototype = proto;
}
return NS_OK;
}
//
// Method for creating a new XULRadioElement JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptXULRadioElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULRadioElement");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMXULRadioElement *aXULRadioElement;
if (nsnull == aParent) {
parent = nsnull;
}
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
NS_RELEASE(owner);
return NS_ERROR_FAILURE;
}
NS_RELEASE(owner);
}
else {
return NS_ERROR_FAILURE;
}
if (NS_OK != NS_InitXULRadioElementClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIXULRadioElementIID, (void **)&aXULRadioElement);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &XULRadioElementClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULRadioElement);
}
else {
NS_RELEASE(aXULRadioElement);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

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

@ -1,327 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nsDOMError.h"
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsCOMPtr.h"
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMXULRadioGroupElement.h"
#include "nsIDOMXULRadioElement.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIXULRadioGroupElementIID, NS_IDOMXULRADIOGROUPELEMENT_IID);
static NS_DEFINE_IID(kIXULRadioElementIID, NS_IDOMXULRADIOELEMENT_IID);
//
// XULRadioGroupElement property ids
//
enum XULRadioGroupElement_slots {
XULRADIOGROUPELEMENT_SELECTEDITEM = -1
};
/***********************************************************************/
//
// XULRadioGroupElement Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetXULRadioGroupElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULRadioGroupElement *a = (nsIDOMXULRadioGroupElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case XULRADIOGROUPELEMENT_SELECTEDITEM:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOGROUPELEMENT_SELECTEDITEM, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMXULRadioElement* prop;
rv = a->GetSelectedItem(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
/***********************************************************************/
//
// XULRadioGroupElement Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetXULRadioGroupElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULRadioGroupElement *a = (nsIDOMXULRadioGroupElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case XULRADIOGROUPELEMENT_SELECTEDITEM:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULRADIOGROUPELEMENT_SELECTEDITEM, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsIDOMXULRadioElement* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kIXULRadioElementIID, NS_ConvertASCIItoUCS2("XULRadioElement"),
cx, *vp)) {
rv = NS_ERROR_DOM_NOT_OBJECT_ERR;
}
rv = a->SetSelectedItem(prop);
NS_IF_RELEASE(prop);
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
//
// XULRadioGroupElement finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeXULRadioGroupElement(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// XULRadioGroupElement enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateXULRadioGroupElement(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// XULRadioGroupElement resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveXULRadioGroupElement(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
/***********************************************************************/
//
// class for XULRadioGroupElement
//
JSClass XULRadioGroupElementClass = {
"XULRadioGroupElement",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub,
JS_PropertyStub,
GetXULRadioGroupElementProperty,
SetXULRadioGroupElementProperty,
EnumerateXULRadioGroupElement,
ResolveXULRadioGroupElement,
JS_ConvertStub,
FinalizeXULRadioGroupElement,
nsnull,
nsJSUtils::nsCheckAccess
};
//
// XULRadioGroupElement class properties
//
static JSPropertySpec XULRadioGroupElementProperties[] =
{
{"selectedItem", XULRADIOGROUPELEMENT_SELECTEDITEM, JSPROP_ENUMERATE},
{0}
};
//
// XULRadioGroupElement class methods
//
static JSFunctionSpec XULRadioGroupElementMethods[] =
{
{0}
};
//
// XULRadioGroupElement constructor
//
PR_STATIC_CALLBACK(JSBool)
XULRadioGroupElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// XULRadioGroupElement class initialization
//
extern "C" NS_DOM nsresult NS_InitXULRadioGroupElementClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *parent_proto = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
jsval vp;
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "XULRadioGroupElement", &vp)) ||
!JSVAL_IS_OBJECT(vp) ||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
!JSVAL_IS_OBJECT(vp)) {
if (NS_OK != NS_InitXULElementClass(aContext, (void **)&parent_proto)) {
return NS_ERROR_FAILURE;
}
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&XULRadioGroupElementClass, // JSClass
XULRadioGroupElement, // JSNative ctor
0, // ctor args
XULRadioGroupElementProperties, // proto props
XULRadioGroupElementMethods, // proto funcs
nsnull, // ctor props (static)
nsnull); // ctor funcs (static)
if (nsnull == proto) {
return NS_ERROR_FAILURE;
}
}
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
proto = JSVAL_TO_OBJECT(vp);
}
else {
return NS_ERROR_FAILURE;
}
if (aPrototype) {
*aPrototype = proto;
}
return NS_OK;
}
//
// Method for creating a new XULRadioGroupElement JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptXULRadioGroupElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULRadioGroupElement");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMXULRadioGroupElement *aXULRadioGroupElement;
if (nsnull == aParent) {
parent = nsnull;
}
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
NS_RELEASE(owner);
return NS_ERROR_FAILURE;
}
NS_RELEASE(owner);
}
else {
return NS_ERROR_FAILURE;
}
if (NS_OK != NS_InitXULRadioGroupElementClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIXULRadioGroupElementIID, (void **)&aXULRadioGroupElement);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &XULRadioGroupElementClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULRadioGroupElement);
}
else {
NS_RELEASE(aXULRadioGroupElement);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

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

@ -1,452 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nsDOMError.h"
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsCOMPtr.h"
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMXULTitledButtonElement.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIXULTitledButtonElementIID, NS_IDOMXULTITLEDBUTTONELEMENT_IID);
//
// XULTitledButtonElement property ids
//
enum XULTitledButtonElement_slots {
XULTITLEDBUTTONELEMENT_VALUE = -1,
XULTITLEDBUTTONELEMENT_CROP = -2,
XULTITLEDBUTTONELEMENT_DISABLED = -3,
XULTITLEDBUTTONELEMENT_SRC = -4,
XULTITLEDBUTTONELEMENT_IMGALIGN = -5,
XULTITLEDBUTTONELEMENT_ACCESSKEY = -6
};
/***********************************************************************/
//
// XULTitledButtonElement Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetXULTitledButtonElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULTitledButtonElement *a = (nsIDOMXULTitledButtonElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case XULTITLEDBUTTONELEMENT_VALUE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_VALUE, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetValue(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULTITLEDBUTTONELEMENT_CROP:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_CROP, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetCrop(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULTITLEDBUTTONELEMENT_DISABLED:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_DISABLED, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
PRBool prop;
rv = a->GetDisabled(&prop);
if (NS_SUCCEEDED(rv)) {
*vp = BOOLEAN_TO_JSVAL(prop);
}
}
break;
}
case XULTITLEDBUTTONELEMENT_SRC:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_SRC, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetSrc(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULTITLEDBUTTONELEMENT_IMGALIGN:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_IMGALIGN, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetImgalign(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
case XULTITLEDBUTTONELEMENT_ACCESSKEY:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_ACCESSKEY, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
rv = a->GetAccesskey(prop);
if (NS_SUCCEEDED(rv)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
/***********************************************************************/
//
// XULTitledButtonElement Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetXULTitledButtonElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULTitledButtonElement *a = (nsIDOMXULTitledButtonElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case XULTITLEDBUTTONELEMENT_VALUE:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_VALUE, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetValue(prop);
}
break;
}
case XULTITLEDBUTTONELEMENT_CROP:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_CROP, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetCrop(prop);
}
break;
}
case XULTITLEDBUTTONELEMENT_DISABLED:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_DISABLED, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
PRBool prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
}
rv = a->SetDisabled(prop);
}
break;
}
case XULTITLEDBUTTONELEMENT_SRC:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_SRC, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetSrc(prop);
}
break;
}
case XULTITLEDBUTTONELEMENT_IMGALIGN:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_IMGALIGN, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetImgalign(prop);
}
break;
}
case XULTITLEDBUTTONELEMENT_ACCESSKEY:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULTITLEDBUTTONELEMENT_ACCESSKEY, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsAutoString prop;
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
rv = a->SetAccesskey(prop);
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
//
// XULTitledButtonElement finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeXULTitledButtonElement(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// XULTitledButtonElement enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateXULTitledButtonElement(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// XULTitledButtonElement resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveXULTitledButtonElement(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
/***********************************************************************/
//
// class for XULTitledButtonElement
//
JSClass XULTitledButtonElementClass = {
"XULTitledButtonElement",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub,
JS_PropertyStub,
GetXULTitledButtonElementProperty,
SetXULTitledButtonElementProperty,
EnumerateXULTitledButtonElement,
ResolveXULTitledButtonElement,
JS_ConvertStub,
FinalizeXULTitledButtonElement,
nsnull,
nsJSUtils::nsCheckAccess
};
//
// XULTitledButtonElement class properties
//
static JSPropertySpec XULTitledButtonElementProperties[] =
{
{"value", XULTITLEDBUTTONELEMENT_VALUE, JSPROP_ENUMERATE},
{"crop", XULTITLEDBUTTONELEMENT_CROP, JSPROP_ENUMERATE},
{"disabled", XULTITLEDBUTTONELEMENT_DISABLED, JSPROP_ENUMERATE},
{"src", XULTITLEDBUTTONELEMENT_SRC, JSPROP_ENUMERATE},
{"imgalign", XULTITLEDBUTTONELEMENT_IMGALIGN, JSPROP_ENUMERATE},
{"accesskey", XULTITLEDBUTTONELEMENT_ACCESSKEY, JSPROP_ENUMERATE},
{0}
};
//
// XULTitledButtonElement class methods
//
static JSFunctionSpec XULTitledButtonElementMethods[] =
{
{0}
};
//
// XULTitledButtonElement constructor
//
PR_STATIC_CALLBACK(JSBool)
XULTitledButtonElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// XULTitledButtonElement class initialization
//
extern "C" NS_DOM nsresult NS_InitXULTitledButtonElementClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *parent_proto = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
jsval vp;
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "XULTitledButtonElement", &vp)) ||
!JSVAL_IS_OBJECT(vp) ||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
!JSVAL_IS_OBJECT(vp)) {
if (NS_OK != NS_InitXULElementClass(aContext, (void **)&parent_proto)) {
return NS_ERROR_FAILURE;
}
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&XULTitledButtonElementClass, // JSClass
XULTitledButtonElement, // JSNative ctor
0, // ctor args
XULTitledButtonElementProperties, // proto props
XULTitledButtonElementMethods, // proto funcs
nsnull, // ctor props (static)
nsnull); // ctor funcs (static)
if (nsnull == proto) {
return NS_ERROR_FAILURE;
}
}
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
proto = JSVAL_TO_OBJECT(vp);
}
else {
return NS_ERROR_FAILURE;
}
if (aPrototype) {
*aPrototype = proto;
}
return NS_OK;
}
//
// Method for creating a new XULTitledButtonElement JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptXULTitledButtonElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULTitledButtonElement");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMXULTitledButtonElement *aXULTitledButtonElement;
if (nsnull == aParent) {
parent = nsnull;
}
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
NS_RELEASE(owner);
return NS_ERROR_FAILURE;
}
NS_RELEASE(owner);
}
else {
return NS_ERROR_FAILURE;
}
if (NS_OK != NS_InitXULTitledButtonElementClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIXULTitledButtonElementIID, (void **)&aXULTitledButtonElement);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &XULTitledButtonElementClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULTitledButtonElement);
}
else {
NS_RELEASE(aXULTitledButtonElement);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

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

@ -1,189 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
/*
Implementation methods for the XUL checkbox element APIs.
*/
#include "nsCOMPtr.h"
#include "nsRDFCID.h"
#include "nsXULCheckboxElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsINameSpaceManager.h"
#include "nsIServiceManager.h"
#include "nsString.h"
//#include "nsIPopupSetFrame.h"
//#include "nsIMenuFrame.h"
//#include "nsIFrame.h"
NS_IMPL_ADDREF_INHERITED(nsXULCheckboxElement, nsXULAggregateElement);
NS_IMPL_RELEASE_INHERITED(nsXULCheckboxElement, nsXULAggregateElement);
nsresult
nsXULCheckboxElement::QueryInterface(REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
if (aIID.Equals(NS_GET_IID(nsIDOMXULCheckboxElement))) {
*aResult = NS_STATIC_CAST(nsIDOMXULCheckboxElement*, this);
}
else {
return nsXULAggregateElement::QueryInterface(aIID, aResult);
}
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aResult));
return NS_OK;
}
MOZ_DECL_CTOR_COUNTER(RDF_nsXULCheckboxElement);
nsXULCheckboxElement::nsXULCheckboxElement(nsIDOMXULElement* aOuter)
: nsXULAggregateElement(aOuter)
{
}
nsXULCheckboxElement::~nsXULCheckboxElement()
{
}
NS_IMETHODIMP
nsXULCheckboxElement::GetValue(nsString& aValue)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("value"), aValue);
}
NS_IMETHODIMP
nsXULCheckboxElement::SetValue(const nsString& aValue)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("value"), aValue);
}
NS_IMETHODIMP
nsXULCheckboxElement::GetCrop(nsString& aCrop)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop);
}
NS_IMETHODIMP
nsXULCheckboxElement::SetCrop(const nsString& aCrop)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop);
}
NS_IMETHODIMP
nsXULCheckboxElement::GetSrc(nsString& aSrc)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc);
}
NS_IMETHODIMP
nsXULCheckboxElement::SetSrc(const nsString& aSrc)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc);
}
NS_IMETHODIMP
nsXULCheckboxElement::GetImgalign(nsString& aImgalign)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("imgalign"), aImgalign);
}
NS_IMETHODIMP
nsXULCheckboxElement::SetImgalign(const nsString& aImgalign)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("imgalign"), aImgalign);
}
NS_IMETHODIMP
nsXULCheckboxElement::GetAccesskey(nsString& aAccesskey)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("accesskey"), aAccesskey);
}
NS_IMETHODIMP
nsXULCheckboxElement::SetAccesskey(const nsString& aAccesskey)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("accesskey"), aAccesskey);
}
NS_IMETHODIMP
nsXULCheckboxElement::GetChecked(PRBool* aChecked)
{
nsAutoString value;
mOuter->GetAttribute(NS_ConvertASCIItoUCS2("checked"), value);
if(value.EqualsWithConversion("true"))
*aChecked = PR_TRUE;
else
*aChecked = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsXULCheckboxElement::SetChecked(PRBool aChecked)
{
PRBool disabled;
GetDisabled(&disabled);
if (disabled)
return NS_OK;
if(aChecked)
mOuter->SetAttribute(NS_ConvertASCIItoUCS2("checked"), NS_ConvertASCIItoUCS2("true"));
else
mOuter->RemoveAttribute(NS_ConvertASCIItoUCS2("checked"));
return NS_OK;
}
NS_IMETHODIMP
nsXULCheckboxElement::GetDisabled(PRBool* aDisabled)
{
nsAutoString value;
mOuter->GetAttribute(NS_ConvertASCIItoUCS2("disabled"), value);
if(value.EqualsWithConversion("true"))
*aDisabled = PR_TRUE;
else
*aDisabled = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsXULCheckboxElement::SetDisabled(PRBool aDisabled)
{
if(aDisabled)
mOuter->SetAttribute(NS_ConvertASCIItoUCS2("disabled"), NS_ConvertASCIItoUCS2("true"));
else
mOuter->RemoveAttribute(NS_ConvertASCIItoUCS2("disabled"));
return NS_OK;
}

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

@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
/*
An aggregate object that implements the XUL titledbutton widget APIs
*/
#ifndef nsXULCheckboxElement_h__
#define nsXULCheckboxElement_h__
#include "nsXULElement.h"
#include "nsIDOMXULCheckboxElement.h"
class nsXULCheckboxElement : public nsXULAggregateElement,
public nsIDOMXULCheckboxElement
{
public:
nsXULCheckboxElement(nsIDOMXULElement* aOuter);
~nsXULCheckboxElement();
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode interface
NS_FORWARD_IDOMNODE(mOuter->);
// nsIDOMElement interface
NS_FORWARD_IDOMELEMENT(mOuter->);
// nsIDOMXULElement interface
NS_FORWARD_IDOMXULELEMENT(mOuter->);
// nsIDOMXULCheckboxElement interface
NS_DECL_IDOMXULCHECKBOXELEMENT
};
#endif // nsXULCheckboxElement_h__

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

@ -111,11 +111,9 @@
#include "nsXULEditorElement.h"
#include "nsXULTreeElement.h"
#include "nsXULPopupElement.h"
#include "nsXULTitledButtonElement.h"
#include "nsXULCheckboxElement.h"
#include "nsXULRadioElement.h"
#include "nsXULRadioGroupElement.h"
#include "nsXULMenuListElement.h"
#include "nsIBoxObject.h"
#include "nsPIBoxObject.h"
#include "nsXULDocument.h"
// Used for the temporary DOM Level2 hack
@ -308,7 +306,6 @@ nsIAtom* nsXULElement::kMenuPopupAtom;
nsIAtom* nsXULElement::kRefAtom;
nsIAtom* nsXULElement::kSelectedAtom;
nsIAtom* nsXULElement::kStyleAtom;
nsIAtom* nsXULElement::kTitledButtonAtom;
nsIAtom* nsXULElement::kTooltipAtom;
nsIAtom* nsXULElement::kTreeAtom;
nsIAtom* nsXULElement::kTreeCellAtom;
@ -322,12 +319,9 @@ nsIAtom* nsXULElement::kBrowserAtom;
nsIAtom* nsXULElement::kEditorAtom;
nsIAtom* nsXULElement::kWidthAtom;
nsIAtom* nsXULElement::kWindowAtom;
nsIAtom* nsXULElement::kCheckboxAtom;
nsIAtom* nsXULElement::kRadioAtom;
nsIAtom* nsXULElement::kRadioGroupAtom;
nsIAtom* nsXULElement::kMenuListAtom;
nsIAtom* nsXULElement::kMenuButtonAtom;
nsIAtom* nsXULElement::kTextFieldAtom;
nsIAtom* nsXULElement::kMenuAtom;
nsIAtom* nsXULElement::kPopupSetAtom;
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
PRUint32 nsXULPrototypeAttribute::gNumElements;
@ -392,7 +386,6 @@ nsXULElement::Init()
kRefAtom = NS_NewAtom("ref");
kSelectedAtom = NS_NewAtom("selected");
kStyleAtom = NS_NewAtom("style");
kTitledButtonAtom = NS_NewAtom("titledbutton");
kTooltipAtom = NS_NewAtom("tooltip");
kTreeAtom = NS_NewAtom("tree");
kTreeCellAtom = NS_NewAtom("treecell");
@ -406,13 +399,10 @@ nsXULElement::Init()
kEditorAtom = NS_NewAtom("editor");
kWidthAtom = NS_NewAtom("width");
kWindowAtom = NS_NewAtom("window");
kCheckboxAtom = NS_NewAtom("checkbox");
kRadioAtom = NS_NewAtom("radio");
kRadioGroupAtom = NS_NewAtom("radiogroup");
kMenuListAtom = NS_NewAtom("menulist");
kMenuButtonAtom = NS_NewAtom("menubutton");
kTextFieldAtom = NS_NewAtom("textfield");
kMenuAtom = NS_NewAtom("menu");
kPopupSetAtom = NS_NewAtom("popupset");
rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
nsnull,
kINameSpaceManagerIID,
@ -476,7 +466,6 @@ nsXULElement::~nsXULElement()
NS_IF_RELEASE(kRefAtom);
NS_IF_RELEASE(kSelectedAtom);
NS_IF_RELEASE(kStyleAtom);
NS_IF_RELEASE(kTitledButtonAtom);
NS_IF_RELEASE(kTooltipAtom);
NS_IF_RELEASE(kTreeAtom);
NS_IF_RELEASE(kTreeCellAtom);
@ -490,12 +479,9 @@ nsXULElement::~nsXULElement()
NS_IF_RELEASE(kEditorAtom);
NS_IF_RELEASE(kWidthAtom);
NS_IF_RELEASE(kWindowAtom);
NS_IF_RELEASE(kCheckboxAtom);
NS_IF_RELEASE(kRadioAtom);
NS_IF_RELEASE(kRadioGroupAtom);
NS_IF_RELEASE(kMenuListAtom);
NS_IF_RELEASE(kMenuButtonAtom);
NS_IF_RELEASE(kTextFieldAtom);
NS_IF_RELEASE(kMenuAtom);
NS_IF_RELEASE(kPopupSetAtom);
NS_IF_RELEASE(gNameSpaceManager);
@ -767,90 +753,6 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULTitledButtonElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kTitledButtonAtom) {
// We delegate XULTitledButtonElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULTitledButtonElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULCheckboxElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kCheckboxAtom) {
// We delegate XULCheckboxElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULCheckboxElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULRadioElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kRadioAtom) {
// We delegate XULRadioElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULRadioElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULRadioGroupElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kRadioGroupAtom) {
// We delegate XULRadioElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULRadioGroupElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULEditorElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
@ -2209,22 +2111,6 @@ nsXULElement::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject)
fn = NS_NewScriptXULBrowserElement;
rootname = "nsXULBrowserElement::mScriptObject";
}
else if (tag.get() == kTitledButtonAtom) {
fn = NS_NewScriptXULTitledButtonElement;
rootname = "nsXULTitledButtonElement::mScriptObject";
}
else if (tag.get() == kCheckboxAtom) {
fn = NS_NewScriptXULCheckboxElement;
rootname = "nsXULCheckboxElement::mScriptObject";
}
else if (tag.get() == kRadioAtom) {
fn = NS_NewScriptXULRadioElement;
rootname = "nsXULRadioElement::mScriptObject";
}
else if (tag.get() == kRadioGroupAtom) {
fn = NS_NewScriptXULRadioGroupElement;
rootname = "nsXULRadioGroupElement::mScriptObject";
}
else if (tag.get() == kMenuListAtom) {
fn = NS_NewScriptXULMenuListElement;
rootname = "nsXULMenuListElement::mScriptObject";
@ -2495,6 +2381,12 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileE
mDocument = aDocument; // not refcounted
if (mBoxObject) {
nsCOMPtr<nsPIBoxObject> privateBox(do_QueryInterface(mBoxObject));
if (privateBox)
privateBox->SetDocument(mDocument);
}
if (mDocument) {
// Add a named reference to the script object.
if (mScriptObject) {
@ -4294,49 +4186,55 @@ nsXULElement::GetControllers(nsIControllers** aResult)
return NS_OK;
}
nsresult
nsXULElement::GetAnonymousContent(nsIDOMNodeList** aResult)
NS_IMETHODIMP
nsXULElement::GetBoxObject(nsIBoxObject** aResult)
{
nsresult rv;
nsRDFDOMNodeList* elements;
// Addref happens on following line in the Create call.
if (NS_FAILED(rv = nsRDFDOMNodeList::Create(&elements))) {
NS_ERROR("unable to create node list");
return rv;
if (mBoxObject) {
*aResult = mBoxObject;
NS_ADDREF(*aResult);
return NS_OK;
}
*aResult = elements;
// Use the XBL service to get a content list.
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
if (!xblService)
return rv;
// Retrieve the anonymous content that we should build.
nsCOMPtr<nsISupportsArray> anonymousItems;
nsCOMPtr<nsIContent> childElement;
PRBool dummy;
xblService->GetContentList(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(anonymousItems),
getter_AddRefs(childElement), &dummy);
if (!anonymousItems)
// We need to create our object.
*aResult = nsnull;
if (!mDocument)
return NS_OK;
PRUint32 count = 0;
anonymousItems->Count(&count);
nsCOMPtr<nsIPresShell> shell = getter_AddRefs(mDocument->GetShellAt(0));
if (!shell)
return NS_OK;
for (PRUint32 i=0; i < count; i++)
{
// get our child's content and set its parent to our content
nsCOMPtr<nsISupports> node;
anonymousItems->GetElementAt(i,getter_AddRefs(node));
nsresult rv;
PRInt32 dummy;
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
nsCAutoString progID("component://netscape/layout/xul-boxobject");
if (tag.get() == kBrowserAtom)
progID += "-browser";
else if (tag.get() == kEditorAtom)
progID += "-editor";
else if (tag.get() == kIFrameAtom)
progID += "-iframe";
else if (tag.get() == kMenuAtom)
progID += "-menu";
else if (tag.get() == kPopupSetAtom)
progID += "-popupset";
else if (tag.get() == kTreeAtom)
progID += "-tree";
nsCOMPtr<nsIDOMNode> content(do_QueryInterface(node));
if (content)
elements->AppendNode(content);
}
mBoxObject = do_CreateInstance(progID);
if (mBoxObject)
return NS_OK;
nsCOMPtr<nsPIBoxObject> privateBox(do_QueryInterface(mBoxObject));
if (NS_FAILED(rv = privateBox->Init(NS_STATIC_CAST(nsIStyledContent*, this), shell)))
return rv;
*aResult = mBoxObject;
NS_ADDREF(*aResult);
return NS_OK;
}
@ -4459,7 +4357,7 @@ nsXULElement::Click()
nsCOMPtr<nsIPresShell> shell; // Strong
nsCOMPtr<nsIPresContext> context;
nsAutoString tagName;
PRBool isButton = NodeInfo()->Equals(NS_ConvertASCIItoUCS2("titledbutton"));
PRBool isButton = NodeInfo()->Equals(NS_ConvertASCIItoUCS2("button"));
for (PRInt32 i=0; i<numShells; i++) {
shell = getter_AddRefs(doc->GetShellAt(i));

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

@ -59,6 +59,7 @@
#include "nsIURI.h"
#include "nsIXMLContent.h"
#include "nsIXULContent.h"
#include "nsIBoxObject.h"
#include "nsXULAttributes.h"
#include "nsIChromeEventHandler.h"
@ -343,10 +344,7 @@ protected:
static nsIAtom* kRefAtom;
static nsIAtom* kSelectedAtom;
static nsIAtom* kStyleAtom;
static nsIAtom* kTitledButtonAtom;
static nsIAtom* kCheckboxAtom;
static nsIAtom* kRadioAtom;
static nsIAtom* kRadioGroupAtom;
static nsIAtom* kTooltipAtom;
static nsIAtom* kTreeAtom;
static nsIAtom* kTreeCellAtom;
@ -360,9 +358,9 @@ protected:
static nsIAtom* kEditorAtom;
static nsIAtom* kWidthAtom;
static nsIAtom* kWindowAtom;
static nsIAtom* kMenuButtonAtom;
static nsIAtom* kMenuListAtom;
static nsIAtom* kTextFieldAtom;
static nsIAtom* kMenuAtom;
static nsIAtom* kPopupSetAtom;
public:
static nsresult
@ -569,6 +567,9 @@ protected:
// Whether or not we're anonymous
PRBool mIsAnonymous;
// Our primary layout object (a wrapper for the Gecko "frame" object)
nsCOMPtr<nsIBoxObject> mBoxObject; // [OWNER]
// Lazily instantiated if/when object is mutated. Instantiating
// the mSlots makes an nsXULElement 'heavyweight'.
struct Slots {

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

@ -40,7 +40,6 @@
#include "nsIServiceManager.h"
#include "nsString.h"
#include "nsIPopupSetFrame.h"
#include "nsIMenuFrame.h"
#include "nsIFrame.h"
NS_IMPL_ADDREF_INHERITED(nsXULMenuListElement, nsXULAggregateElement);

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

@ -34,6 +34,7 @@
#include "nsXULAtoms.h"
#include "nsIDOMElement.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNSDocument.h"
#include "nsIXULPopupListener.h"
#include "nsIDOMMouseListener.h"
#include "nsIDOMMouseMotionListener.h"
@ -474,9 +475,10 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
if (popup)
popupContent = do_QueryInterface(popup);
} else {
nsCOMPtr<nsIDOMNSDocument> nsDoc(do_QueryInterface(xulDocument));
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(content));
nsCOMPtr<nsIDOMNodeList> list;
xulElement->GetAnonymousContent(getter_AddRefs(list));
nsDoc->GetAnonymousNodes(xulElement, getter_AddRefs(list));
if (list) {
PRUint32 ctr,listLength;
nsCOMPtr<nsIDOMNode> node;

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

@ -1,185 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
/*
Implementation methods for the XUL radio element APIs.
*/
#include "nsCOMPtr.h"
#include "nsRDFCID.h"
#include "nsXULRadioElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsINameSpaceManager.h"
#include "nsIServiceManager.h"
#include "nsString.h"
//#include "nsIPopupSetFrame.h"
//#include "nsIMenuFrame.h"
//#include "nsIFrame.h"
NS_IMPL_ADDREF_INHERITED(nsXULRadioElement, nsXULAggregateElement);
NS_IMPL_RELEASE_INHERITED(nsXULRadioElement, nsXULAggregateElement);
nsresult
nsXULRadioElement::QueryInterface(REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
if (aIID.Equals(NS_GET_IID(nsIDOMXULRadioElement))) {
*aResult = NS_STATIC_CAST(nsIDOMXULRadioElement*, this);
}
else {
return nsXULAggregateElement::QueryInterface(aIID, aResult);
}
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aResult));
return NS_OK;
}
MOZ_DECL_CTOR_COUNTER(RDF_nsXULRadioElement);
nsXULRadioElement::nsXULRadioElement(nsIDOMXULElement* aOuter)
: nsXULAggregateElement(aOuter)
{
}
nsXULRadioElement::~nsXULRadioElement()
{
}
NS_IMETHODIMP
nsXULRadioElement::GetValue(nsString& aValue)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("value"), aValue);
}
NS_IMETHODIMP
nsXULRadioElement::SetValue(const nsString& aValue)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("value"), aValue);
}
NS_IMETHODIMP
nsXULRadioElement::GetCrop(nsString& aCrop)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop);
}
NS_IMETHODIMP
nsXULRadioElement::SetCrop(const nsString& aCrop)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop);
}
NS_IMETHODIMP
nsXULRadioElement::GetSrc(nsString& aSrc)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc);
}
NS_IMETHODIMP
nsXULRadioElement::SetSrc(const nsString& aSrc)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc);
}
NS_IMETHODIMP
nsXULRadioElement::GetImgalign(nsString& aImgalign)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("imgalign"), aImgalign);
}
NS_IMETHODIMP
nsXULRadioElement::SetImgalign(const nsString& aImgalign)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("imgalign"), aImgalign);
}
NS_IMETHODIMP
nsXULRadioElement::GetAccesskey(nsString& aAccesskey)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("accesskey"), aAccesskey);
}
NS_IMETHODIMP
nsXULRadioElement::SetAccesskey(const nsString& aAccesskey)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("accesskey"), aAccesskey);
}
NS_IMETHODIMP
nsXULRadioElement::GetChecked(PRBool* aChecked)
{
nsAutoString value;
mOuter->GetAttribute(NS_ConvertASCIItoUCS2("checked"), value);
if(value.EqualsWithConversion("true"))
*aChecked = PR_TRUE;
else
*aChecked = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsXULRadioElement::SetChecked(PRBool aChecked)
{
if(aChecked)
mOuter->SetAttribute(NS_ConvertASCIItoUCS2("checked"), NS_ConvertASCIItoUCS2("true"));
else
mOuter->RemoveAttribute(NS_ConvertASCIItoUCS2("checked"));
return NS_OK;
}
NS_IMETHODIMP
nsXULRadioElement::GetDisabled(PRBool* aDisabled)
{
nsAutoString value;
mOuter->GetAttribute(NS_ConvertASCIItoUCS2("disabled"), value);
if(value.EqualsWithConversion("true"))
*aDisabled = PR_TRUE;
else
*aDisabled = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsXULRadioElement::SetDisabled(PRBool aDisabled)
{
if(aDisabled)
mOuter->SetAttribute(NS_ConvertASCIItoUCS2("disabled"), NS_ConvertASCIItoUCS2("true"));
else
mOuter->RemoveAttribute(NS_ConvertASCIItoUCS2("disabled"));
return NS_OK;
}

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

@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
/*
An aggregate object that implements the XUL Radio widget APIs
*/
#ifndef nsXULRadioElement_h__
#define nsXULRadioElement_h__
#include "nsXULElement.h"
#include "nsIDOMXULRadioElement.h"
class nsXULRadioElement : public nsXULAggregateElement,
public nsIDOMXULRadioElement
{
public:
nsXULRadioElement(nsIDOMXULElement* aOuter);
~nsXULRadioElement();
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode interface
NS_FORWARD_IDOMNODE(mOuter->);
// nsIDOMElement interface
NS_FORWARD_IDOMELEMENT(mOuter->);
// nsIDOMXULElement interface
NS_FORWARD_IDOMXULELEMENT(mOuter->);
// nsIDOMXULRadioElement interface
NS_DECL_IDOMXULRADIOELEMENT
};
#endif // nsXULRadioElement_h__

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

@ -1,101 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
/*
Implementation methods for the XUL radio element APIs.
*/
#include "nsCOMPtr.h"
#include "nsRDFCID.h"
#include "nsXULRadioGroupElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsINameSpaceManager.h"
#include "nsIServiceManager.h"
#include "nsString.h"
//#include "nsIPopupSetFrame.h"
//#include "nsIMenuFrame.h"
//#include "nsIFrame.h"
NS_IMPL_ADDREF_INHERITED(nsXULRadioGroupElement, nsXULAggregateElement);
NS_IMPL_RELEASE_INHERITED(nsXULRadioGroupElement, nsXULAggregateElement);
nsresult
nsXULRadioGroupElement::QueryInterface(REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
if (aIID.Equals(NS_GET_IID(nsIDOMXULRadioGroupElement))) {
*aResult = NS_STATIC_CAST(nsIDOMXULRadioGroupElement*, this);
}
else {
return nsXULAggregateElement::QueryInterface(aIID, aResult);
}
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aResult));
return NS_OK;
}
MOZ_DECL_CTOR_COUNTER(RDF_nsXULRadioGroupElement);
nsXULRadioGroupElement::nsXULRadioGroupElement(nsIDOMXULElement* aOuter)
: nsXULAggregateElement(aOuter)
{
}
nsXULRadioGroupElement::~nsXULRadioGroupElement()
{
}
NS_IMETHODIMP
nsXULRadioGroupElement::GetSelectedItem(nsIDOMXULRadioElement** aResult)
{
*aResult = mSelectedItem;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
NS_IMETHODIMP
nsXULRadioGroupElement::SetSelectedItem(nsIDOMXULRadioElement* aItem)
{
if (aItem) {
PRBool disabled;
aItem->GetDisabled(&disabled);
if (disabled)
return NS_OK;
}
if (mSelectedItem)
mSelectedItem->SetChecked(PR_FALSE);
mSelectedItem = aItem;
if (mSelectedItem)
mSelectedItem->SetChecked(PR_TRUE);
return NS_OK;
}

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

@ -1,65 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
/*
An aggregate object that implements the XUL Radio widget APIs
*/
#ifndef nsXULRadioGroupElement_h__
#define nsXULRadioGroupElement_h__
#include "nsXULElement.h"
#include "nsIDOMXULRadioGroupElement.h"
#include "nsIDOMXULRadioElement.h"
#include "nsCOMPtr.h"
class nsXULRadioGroupElement : public nsXULAggregateElement,
public nsIDOMXULRadioGroupElement
{
public:
nsXULRadioGroupElement(nsIDOMXULElement* aOuter);
~nsXULRadioGroupElement();
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode interface
NS_FORWARD_IDOMNODE(mOuter->);
// nsIDOMElement interface
NS_FORWARD_IDOMELEMENT(mOuter->);
// nsIDOMXULElement interface
NS_FORWARD_IDOMXULELEMENT(mOuter->);
// nsIDOMXULRadioGroupElement interface
NS_DECL_IDOMXULRADIOGROUPELEMENT
protected:
nsCOMPtr<nsIDOMXULRadioElement> mSelectedItem;
};
#endif // nsXULRadioGroupElement_h__

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

@ -1,160 +0,0 @@
/* -*- 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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
/*
Implementation methods for the XULTitledButton element APIs.
*/
#include "nsCOMPtr.h"
#include "nsRDFCID.h"
#include "nsXULTitledButtonElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsINameSpaceManager.h"
#include "nsIServiceManager.h"
#include "nsString.h"
#include "nsIPopupSetFrame.h"
#include "nsIMenuFrame.h"
#include "nsIFrame.h"
NS_IMPL_ADDREF_INHERITED(nsXULTitledButtonElement, nsXULAggregateElement);
NS_IMPL_RELEASE_INHERITED(nsXULTitledButtonElement, nsXULAggregateElement);
nsresult
nsXULTitledButtonElement::QueryInterface(REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
if (aIID.Equals(NS_GET_IID(nsIDOMXULTitledButtonElement))) {
*aResult = NS_STATIC_CAST(nsIDOMXULTitledButtonElement*, this);
}
else {
return nsXULAggregateElement::QueryInterface(aIID, aResult);
}
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aResult));
return NS_OK;
}
MOZ_DECL_CTOR_COUNTER(RDF_nsXULTitledButtonElement);
nsXULTitledButtonElement::nsXULTitledButtonElement(nsIDOMXULElement* aOuter)
: nsXULAggregateElement(aOuter)
{
}
nsXULTitledButtonElement::~nsXULTitledButtonElement()
{
}
NS_IMETHODIMP
nsXULTitledButtonElement::GetValue(nsString& aValue)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("value"), aValue);
}
NS_IMETHODIMP
nsXULTitledButtonElement::SetValue(const nsString& aValue)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("value"), aValue);
}
NS_IMETHODIMP
nsXULTitledButtonElement::GetCrop(nsString& aCrop)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop);
}
NS_IMETHODIMP
nsXULTitledButtonElement::SetCrop(const nsString& aCrop)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop);
}
NS_IMETHODIMP
nsXULTitledButtonElement::GetSrc(nsString& aSrc)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc);
}
NS_IMETHODIMP
nsXULTitledButtonElement::SetSrc(const nsString& aSrc)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc);
}
NS_IMETHODIMP
nsXULTitledButtonElement::GetImgalign(nsString& aImgalign)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("imgalign"), aImgalign);
}
NS_IMETHODIMP
nsXULTitledButtonElement::SetImgalign(const nsString& aImgalign)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("imgalign"), aImgalign);
}
NS_IMETHODIMP
nsXULTitledButtonElement::GetAccesskey(nsString& aAccesskey)
{
return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("accesskey"), aAccesskey);
}
NS_IMETHODIMP
nsXULTitledButtonElement::SetAccesskey(const nsString& aAccesskey)
{
return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("accesskey"), aAccesskey);
}
NS_IMETHODIMP
nsXULTitledButtonElement::GetDisabled(PRBool* aDisabled)
{
nsAutoString value;
mOuter->GetAttribute(NS_ConvertASCIItoUCS2("disabled"), value);
if(value.EqualsWithConversion("true"))
*aDisabled = PR_TRUE;
else
*aDisabled = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsXULTitledButtonElement::SetDisabled(PRBool aDisabled)
{
if(aDisabled)
mOuter->SetAttribute(NS_ConvertASCIItoUCS2("disabled"), NS_ConvertASCIItoUCS2("true"));
else
mOuter->RemoveAttribute(NS_ConvertASCIItoUCS2("disabled"));
return NS_OK;
}

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

@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
/*
An aggregate object that implements the XUL titledbutton widget APIs
*/
#ifndef nsXULTitledButtonElement_h__
#define nsXULTitledButtonElement_h__
#include "nsXULElement.h"
#include "nsIDOMXULTitledButtonElement.h"
class nsXULTitledButtonElement : public nsXULAggregateElement,
public nsIDOMXULTitledButtonElement
{
public:
nsXULTitledButtonElement(nsIDOMXULElement* aOuter);
~nsXULTitledButtonElement();
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode interface
NS_FORWARD_IDOMNODE(mOuter->);
// nsIDOMElement interface
NS_FORWARD_IDOMELEMENT(mOuter->);
// nsIDOMXULElement interface
NS_FORWARD_IDOMXULELEMENT(mOuter->);
// nsIDOMXULTitledButtonElement interface
NS_DECL_IDOMXULTITLEDBUTTONELEMENT
protected:
};
#endif // nsXULTitledButtonElement_h__