1998-04-13 20:24:54 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* 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/
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* 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.
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-04-13 20:24:54 +00:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 03:40:37 +00:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsIScriptObjectOwner_h__
|
|
|
|
#define nsIScriptObjectOwner_h__
|
|
|
|
|
|
|
|
#include "nscore.h"
|
|
|
|
#include "nsISupports.h"
|
1998-06-23 18:43:06 +00:00
|
|
|
#include "nsIScriptContext.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
class nsIScriptContext;
|
|
|
|
|
|
|
|
#define NS_ISCRIPTOBJECTOWNER_IID \
|
|
|
|
{ /* 8f6bca7e-ce42-11d1-b724-00600891d8c9 */ \
|
|
|
|
0x8f6bca7e, 0xce42, 0x11d1, \
|
|
|
|
{0xb7, 0x24, 0x00, 0x60, 0x08, 0x91, 0xd8, 0xc9} } \
|
|
|
|
|
1998-04-15 18:55:21 +00:00
|
|
|
/**
|
|
|
|
* Creates a link between the script object and its native implementation
|
|
|
|
*<P>
|
|
|
|
* Every object that wants to be exposed in a script environment should
|
|
|
|
* implement this interface. This interface should guarantee that the same
|
|
|
|
* script object is returned in the context of the same script.
|
|
|
|
* <P><I>It does have a bit too much java script information now, that
|
|
|
|
* should be removed in a short time. Ideally this interface will be
|
|
|
|
* language neutral</I>
|
|
|
|
*/
|
1998-04-13 20:24:54 +00:00
|
|
|
class nsIScriptObjectOwner : public nsISupports {
|
|
|
|
public:
|
1999-08-20 09:51:02 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCRIPTOBJECTOWNER_IID)
|
1998-04-15 18:55:21 +00:00
|
|
|
/**
|
|
|
|
* Return the script object associated with this object.
|
|
|
|
* Create a script object if not present.
|
|
|
|
*
|
|
|
|
* @param aContext the context the script object has to be created in
|
|
|
|
* @param aScriptObject on return will contain the script object
|
|
|
|
*
|
|
|
|
* @return nsresult NS_OK if the script object is successfully returned
|
|
|
|
*
|
|
|
|
**/
|
1998-06-23 18:43:06 +00:00
|
|
|
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject) = 0;
|
1998-04-15 18:55:21 +00:00
|
|
|
|
|
|
|
/**
|
1998-09-17 01:53:52 +00:00
|
|
|
* Set the script object associated with this object.
|
|
|
|
* Often used to either reset the object to null or initially
|
|
|
|
* set it in cases where the object comes before the owner.
|
|
|
|
*
|
|
|
|
* @param aScriptObject the script object to set
|
|
|
|
*
|
|
|
|
* @return nsresult NS_OK if the script object is successfully set
|
1998-04-15 18:55:21 +00:00
|
|
|
*
|
|
|
|
**/
|
1998-09-17 01:53:52 +00:00
|
|
|
NS_IMETHOD SetScriptObject(void* aScriptObject) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsIScriptObjectOwner_h__
|