зеркало из https://github.com/mozilla/pjs.git
Adding more to the tree's idl.
This commit is contained in:
Родитель
2de2cc6d8a
Коммит
7f859a0884
|
@ -46,12 +46,20 @@ nsXULTreeElement::nsXULTreeElement(nsIDOMXULElement* aOuter)
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create DOM node list");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
mSelectedRows = children;
|
||||
|
||||
children = nsnull;
|
||||
rv = nsRDFDOMNodeList::Create(&children);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create DOM node list");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
mSelectedCells = children;
|
||||
}
|
||||
|
||||
nsXULTreeElement::~nsXULTreeElement()
|
||||
{
|
||||
NS_IF_RELEASE(mSelectedItems);
|
||||
NS_IF_RELEASE(mSelectedRows);
|
||||
NS_IF_RELEASE(mSelectedCells);
|
||||
}
|
||||
|
||||
|
@ -63,6 +71,14 @@ nsXULTreeElement::GetSelectedItems(nsIDOMNodeList** aSelectedItems)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::GetSelectedRows(nsIDOMNodeList** aSelectedRows)
|
||||
{
|
||||
NS_IF_ADDREF(mSelectedRows);
|
||||
*aSelectedRows = mSelectedRows;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::GetSelectedCells(nsIDOMNodeList** aSelectedCells)
|
||||
{
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
|
||||
protected:
|
||||
nsIDOMNodeList* mSelectedItems;
|
||||
nsIDOMNodeList* mSelectedRows;
|
||||
nsIDOMNodeList* mSelectedCells;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,5 +2,6 @@ interface XULTreeElement : XULElement {
|
|||
/* IID: { 0xa6cf90ec, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } */
|
||||
readonly attribute NodeList selectedItems;
|
||||
readonly attribute NodeList selectedRows;
|
||||
readonly attribute NodeList selectedCells;
|
||||
};
|
||||
|
|
|
@ -37,18 +37,22 @@ public:
|
|||
|
||||
NS_IMETHOD GetSelectedItems(nsIDOMNodeList** aSelectedItems)=0;
|
||||
|
||||
NS_IMETHOD GetSelectedRows(nsIDOMNodeList** aSelectedRows)=0;
|
||||
|
||||
NS_IMETHOD GetSelectedCells(nsIDOMNodeList** aSelectedCells)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMXULTREEELEMENT \
|
||||
NS_IMETHOD GetSelectedItems(nsIDOMNodeList** aSelectedItems); \
|
||||
NS_IMETHOD GetSelectedRows(nsIDOMNodeList** aSelectedRows); \
|
||||
NS_IMETHOD GetSelectedCells(nsIDOMNodeList** aSelectedCells); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMXULTREEELEMENT(_to) \
|
||||
NS_IMETHOD GetSelectedItems(nsIDOMNodeList** aSelectedItems) { return _to GetSelectedItems(aSelectedItems); } \
|
||||
NS_IMETHOD GetSelectedRows(nsIDOMNodeList** aSelectedRows) { return _to GetSelectedRows(aSelectedRows); } \
|
||||
NS_IMETHOD GetSelectedCells(nsIDOMNodeList** aSelectedCells) { return _to GetSelectedCells(aSelectedCells); } \
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,8 @@ NS_DEF_PTR(nsIDOMNodeList);
|
|||
//
|
||||
enum XULTreeElement_slots {
|
||||
XULTREEELEMENT_SELECTEDITEMS = -1,
|
||||
XULTREEELEMENT_SELECTEDCELLS = -2
|
||||
XULTREEELEMENT_SELECTEDROWS = -2,
|
||||
XULTREEELEMENT_SELECTEDCELLS = -3
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -87,6 +88,23 @@ GetXULTreeElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case XULTREEELEMENT_SELECTEDROWS:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xultreeelement.selectedrows", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIDOMNodeList* prop;
|
||||
if (NS_SUCCEEDED(a->GetSelectedRows(&prop))) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULTREEELEMENT_SELECTEDCELLS:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xultreeelement.selectedcells", &ok);
|
||||
|
@ -206,6 +224,7 @@ JSClass XULTreeElementClass = {
|
|||
static JSPropertySpec XULTreeElementProperties[] =
|
||||
{
|
||||
{"selectedItems", XULTREEELEMENT_SELECTEDITEMS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"selectedRows", XULTREEELEMENT_SELECTEDROWS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"selectedCells", XULTREEELEMENT_SELECTEDCELLS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
|
|
@ -2,5 +2,6 @@ interface XULTreeElement : XULElement {
|
|||
/* IID: { 0xa6cf90ec, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } */
|
||||
readonly attribute NodeList selectedItems;
|
||||
readonly attribute NodeList selectedRows;
|
||||
readonly attribute NodeList selectedCells;
|
||||
};
|
||||
|
|
|
@ -37,18 +37,22 @@ public:
|
|||
|
||||
NS_IMETHOD GetSelectedItems(nsIDOMNodeList** aSelectedItems)=0;
|
||||
|
||||
NS_IMETHOD GetSelectedRows(nsIDOMNodeList** aSelectedRows)=0;
|
||||
|
||||
NS_IMETHOD GetSelectedCells(nsIDOMNodeList** aSelectedCells)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMXULTREEELEMENT \
|
||||
NS_IMETHOD GetSelectedItems(nsIDOMNodeList** aSelectedItems); \
|
||||
NS_IMETHOD GetSelectedRows(nsIDOMNodeList** aSelectedRows); \
|
||||
NS_IMETHOD GetSelectedCells(nsIDOMNodeList** aSelectedCells); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMXULTREEELEMENT(_to) \
|
||||
NS_IMETHOD GetSelectedItems(nsIDOMNodeList** aSelectedItems) { return _to GetSelectedItems(aSelectedItems); } \
|
||||
NS_IMETHOD GetSelectedRows(nsIDOMNodeList** aSelectedRows) { return _to GetSelectedRows(aSelectedRows); } \
|
||||
NS_IMETHOD GetSelectedCells(nsIDOMNodeList** aSelectedCells) { return _to GetSelectedCells(aSelectedCells); } \
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,8 @@ NS_DEF_PTR(nsIDOMNodeList);
|
|||
//
|
||||
enum XULTreeElement_slots {
|
||||
XULTREEELEMENT_SELECTEDITEMS = -1,
|
||||
XULTREEELEMENT_SELECTEDCELLS = -2
|
||||
XULTREEELEMENT_SELECTEDROWS = -2,
|
||||
XULTREEELEMENT_SELECTEDCELLS = -3
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -87,6 +88,23 @@ GetXULTreeElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case XULTREEELEMENT_SELECTEDROWS:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xultreeelement.selectedrows", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsIDOMNodeList* prop;
|
||||
if (NS_SUCCEEDED(a->GetSelectedRows(&prop))) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XULTREEELEMENT_SELECTEDCELLS:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "xultreeelement.selectedcells", &ok);
|
||||
|
@ -206,6 +224,7 @@ JSClass XULTreeElementClass = {
|
|||
static JSPropertySpec XULTreeElementProperties[] =
|
||||
{
|
||||
{"selectedItems", XULTREEELEMENT_SELECTEDITEMS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"selectedRows", XULTREEELEMENT_SELECTEDROWS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"selectedCells", XULTREEELEMENT_SELECTEDCELLS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
|
|
@ -46,12 +46,20 @@ nsXULTreeElement::nsXULTreeElement(nsIDOMXULElement* aOuter)
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create DOM node list");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
mSelectedRows = children;
|
||||
|
||||
children = nsnull;
|
||||
rv = nsRDFDOMNodeList::Create(&children);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create DOM node list");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
mSelectedCells = children;
|
||||
}
|
||||
|
||||
nsXULTreeElement::~nsXULTreeElement()
|
||||
{
|
||||
NS_IF_RELEASE(mSelectedItems);
|
||||
NS_IF_RELEASE(mSelectedRows);
|
||||
NS_IF_RELEASE(mSelectedCells);
|
||||
}
|
||||
|
||||
|
@ -63,6 +71,14 @@ nsXULTreeElement::GetSelectedItems(nsIDOMNodeList** aSelectedItems)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::GetSelectedRows(nsIDOMNodeList** aSelectedRows)
|
||||
{
|
||||
NS_IF_ADDREF(mSelectedRows);
|
||||
*aSelectedRows = mSelectedRows;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::GetSelectedCells(nsIDOMNodeList** aSelectedCells)
|
||||
{
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
|
||||
protected:
|
||||
nsIDOMNodeList* mSelectedItems;
|
||||
nsIDOMNodeList* mSelectedRows;
|
||||
nsIDOMNodeList* mSelectedCells;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче