Added another createPopup method to handle anchoring.

This commit is contained in:
hyatt%netscape.com 1999-05-14 21:16:51 +00:00
Родитель c4404415bc
Коммит 76e89d2a22
5 изменённых файлов: 81 добавлений и 0 удалений

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

@ -139,6 +139,8 @@ public:
NS_IMETHOD CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aPopupAlignment)=0;
NS_IMETHOD CreateAnchoredPopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent, const nsString& aAnchorAlignment, const nsString& aPopupType, const nsString& aPopupAlignment)=0;
NS_IMETHOD Open(JSContext *cx, jsval *argv, PRUint32 argc, nsIDOMWindow** aReturn)=0;
NS_IMETHOD OpenDialog(JSContext *cx, jsval *argv, PRUint32 argc, nsIDOMWindow** aReturn)=0;
@ -201,6 +203,7 @@ public:
NS_IMETHOD SetTimeout(JSContext *cx, jsval *argv, PRUint32 argc, PRInt32* aReturn); \
NS_IMETHOD SetInterval(JSContext *cx, jsval *argv, PRUint32 argc, PRInt32* aReturn); \
NS_IMETHOD CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aPopupAlignment); \
NS_IMETHOD CreateAnchoredPopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent, const nsString& aAnchorAlignment, const nsString& aPopupType, const nsString& aPopupAlignment); \
NS_IMETHOD Open(JSContext *cx, jsval *argv, PRUint32 argc, nsIDOMWindow** aReturn); \
NS_IMETHOD OpenDialog(JSContext *cx, jsval *argv, PRUint32 argc, nsIDOMWindow** aReturn); \
@ -262,6 +265,7 @@ public:
NS_IMETHOD SetTimeout(JSContext *cx, jsval *argv, PRUint32 argc, PRInt32* aReturn) { return _to SetTimeout(cx, argv, argc, aReturn); } \
NS_IMETHOD SetInterval(JSContext *cx, jsval *argv, PRUint32 argc, PRInt32* aReturn) { return _to SetInterval(cx, argv, argc, aReturn); } \
NS_IMETHOD CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aPopupAlignment) { return _to CreatePopup(aElement, aPopupContent, aXPos, aYPos, aPopupType, aPopupAlignment); } \
NS_IMETHOD CreateAnchoredPopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent, const nsString& aAnchorAlignment, const nsString& aPopupType, const nsString& aPopupAlignment) { return _to CreateAnchoredPopup(aElement, aPopupContent, aAnchorAlignment, aPopupType, aPopupAlignment); } \
NS_IMETHOD Open(JSContext *cx, jsval *argv, PRUint32 argc, nsIDOMWindow** aReturn) { return _to Open(cx, argv, argc, aReturn); } \
NS_IMETHOD OpenDialog(JSContext *cx, jsval *argv, PRUint32 argc, nsIDOMWindow** aReturn) { return _to OpenDialog(cx, argv, argc, aReturn); } \

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

@ -52,6 +52,10 @@
in long xPos, in long yPos,
in DOMString popupType, in DOMString popupAlignment);
void createAnchoredPopup(in Element element, in Element popupContent,
in DOMString anchorAlignment,
in DOMString popupType, in DOMString popupAlignment);
Window open(/* ... */);
Window openDialog(/* ... */);
};

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

@ -1636,6 +1636,14 @@ GlobalWindowImpl::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupCont
return NS_OK;
}
NS_IMETHODIMP
GlobalWindowImpl::CreateAnchoredPopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent,
const nsString& anAnchorAlignment,
const nsString& aPopupType, const nsString& aPopupAlignment)
{
return NS_OK;
}
nsresult
GlobalWindowImpl::CheckWindowName(JSContext *cx, nsString& aName)
{

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

@ -152,6 +152,10 @@ public:
NS_IMETHOD CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent,
PRInt32 aXPos, PRInt32 aYPos,
const nsString& aPopupType, const nsString& aPopupAlignment);
NS_IMETHOD CreateAnchoredPopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent,
const nsString& anAnchorAlignment,
const nsString& aPopupType, const nsString& aPopupAlignment);
// nsIDOMEventCapturer interface
NS_IMETHOD CaptureEvent(const nsString& aType);

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

@ -1416,6 +1416,66 @@ WindowCreatePopup(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
}
//
// Native method CreateAnchoredPopup
//
PR_STATIC_CALLBACK(JSBool)
WindowCreateAnchoredPopup(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMWindow *nativeThis = (nsIDOMWindow*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMElementPtr b0;
nsIDOMElementPtr b1;
nsAutoString b2;
nsAutoString b3;
nsAutoString b4;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 5) {
if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&b0,
kIElementIID,
"Element",
cx,
argv[0])) {
return JS_FALSE;
}
if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&b1,
kIElementIID,
"Element",
cx,
argv[1])) {
return JS_FALSE;
}
nsJSUtils::nsConvertJSValToString(b2, cx, argv[2]);
nsJSUtils::nsConvertJSValToString(b3, cx, argv[3]);
nsJSUtils::nsConvertJSValToString(b4, cx, argv[4]);
if (NS_OK != nativeThis->CreateAnchoredPopup(b0, b1, b2, b3, b4)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function createAnchoredPopup requires 5 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
//
// Native method Open
//
@ -1763,6 +1823,7 @@ static JSFunctionSpec WindowMethods[] =
{"setTimeout", WindowSetTimeout, 0},
{"setInterval", WindowSetInterval, 0},
{"createPopup", WindowCreatePopup, 6},
{"createAnchoredPopup", WindowCreateAnchoredPopup, 5},
{"open", WindowOpen, 0},
{"openDialog", WindowOpenDialog, 0},
{"captureEvent", EventCapturerCaptureEvent, 1},