2001-09-25 05:32:19 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 01:52:36 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-06-07 11:54:32 +04:00
|
|
|
*
|
2004-04-18 01:52:36 +04:00
|
|
|
* The contents of this file are subject to the Mozilla 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/MPL/
|
1998-06-07 11:54:32 +04:00
|
|
|
*
|
2001-09-25 05:32:19 +04: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-06-07 11:54:32 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 01:52:36 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 05:32:19 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
1999-11-28 13:32:13 +03:00
|
|
|
* Contributor(s):
|
2001-09-25 05:32:19 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 01:52:36 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-25 05:32:19 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 01:52:36 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 05:32:19 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 01:52:36 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-25 05:32:19 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-06-07 11:54:32 +04:00
|
|
|
|
|
|
|
#ifndef nsIEventListenerManager_h__
|
|
|
|
#define nsIEventListenerManager_h__
|
|
|
|
|
2008-10-16 04:10:49 +04:00
|
|
|
#include "nsEvent.h"
|
1998-06-07 11:54:32 +04:00
|
|
|
#include "nsISupports.h"
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
class nsPresContext;
|
1998-06-07 11:54:32 +04:00
|
|
|
class nsIDOMEventListener;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
class nsIScriptContext;
|
2000-05-16 15:35:12 +04:00
|
|
|
class nsIDOMEventTarget;
|
2002-11-09 03:25:25 +03:00
|
|
|
class nsIDOMEventGroup;
|
2004-05-04 01:48:36 +04:00
|
|
|
class nsIAtom;
|
2008-10-08 15:35:29 +04:00
|
|
|
class nsPIDOMEventTarget;
|
2009-10-16 12:57:32 +04:00
|
|
|
class nsIEventListenerInfo;
|
|
|
|
template<class E> class nsCOMArray;
|
2009-10-24 19:52:29 +04:00
|
|
|
class nsCxPusher;
|
1998-06-07 11:54:32 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Event listener manager interface.
|
|
|
|
*/
|
|
|
|
#define NS_IEVENTLISTENERMANAGER_IID \
|
2010-04-16 13:04:41 +04:00
|
|
|
{ 0xe86a148b, 0x0563, 0x454f, \
|
|
|
|
{ 0x8c, 0xf2, 0xbd, 0xc4, 0x7c, 0xe6, 0xbe, 0x91 } }
|
1998-06-07 11:54:32 +04:00
|
|
|
|
|
|
|
class nsIEventListenerManager : public nsISupports {
|
|
|
|
|
|
|
|
public:
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEVENTLISTENERMANAGER_IID)
|
1998-06-07 11:54:32 +04:00
|
|
|
|
2008-10-16 01:06:32 +04:00
|
|
|
nsIEventListenerManager() : mMayHavePaintEventListener(PR_FALSE),
|
|
|
|
mMayHaveMutationListeners(PR_FALSE),
|
2009-10-24 19:52:29 +04:00
|
|
|
mMayHaveCapturingListeners(PR_FALSE),
|
|
|
|
mMayHaveSystemGroupListeners(PR_FALSE),
|
2008-10-16 04:10:49 +04:00
|
|
|
mNoListenerForEvent(0)
|
2008-10-16 01:06:32 +04:00
|
|
|
{}
|
|
|
|
|
1998-06-07 11:54:32 +04:00
|
|
|
/**
|
1999-11-28 13:32:13 +03:00
|
|
|
* Sets events listeners of all types.
|
1998-06-07 11:54:32 +04:00
|
|
|
* @param an event listener
|
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
|
|
|
|
const nsIID& aIID, PRInt32 flags) = 0;
|
1999-11-28 13:32:13 +03:00
|
|
|
|
1999-03-29 02:22:54 +04:00
|
|
|
/**
|
1999-11-28 13:32:13 +03:00
|
|
|
* Removes events listeners of all types.
|
1999-03-29 02:22:54 +04:00
|
|
|
* @param an event listener
|
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
|
|
|
const nsIID& aIID, PRInt32 flags) = 0;
|
1999-03-29 02:22:54 +04:00
|
|
|
|
|
|
|
/**
|
1999-11-28 13:32:13 +03:00
|
|
|
* Sets events listeners of all types.
|
1999-03-29 02:22:54 +04:00
|
|
|
* @param an event listener
|
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_IMETHOD AddEventListenerByType(nsIDOMEventListener *aListener,
|
2002-03-24 02:13:20 +03:00
|
|
|
const nsAString& type,
|
2002-11-09 03:25:25 +03:00
|
|
|
PRInt32 flags,
|
|
|
|
nsIDOMEventGroup* aEvtGrp) = 0;
|
1999-11-28 13:32:13 +03:00
|
|
|
|
1999-03-29 02:22:54 +04:00
|
|
|
/**
|
1999-11-28 13:32:13 +03:00
|
|
|
* Removes events listeners of all types.
|
1999-03-29 02:22:54 +04:00
|
|
|
* @param an event listener
|
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_IMETHOD RemoveEventListenerByType(nsIDOMEventListener *aListener,
|
2002-03-24 02:13:20 +03:00
|
|
|
const nsAString& type,
|
2002-11-09 03:25:25 +03:00
|
|
|
PRInt32 flags,
|
|
|
|
nsIDOMEventGroup* aEvtGrp) = 0;
|
1999-03-29 02:22:54 +04:00
|
|
|
|
1998-07-31 22:21:37 +04:00
|
|
|
/**
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
* Creates a script event listener for the given script object with
|
|
|
|
* name aName and function body aFunc.
|
1998-07-31 22:21:37 +04:00
|
|
|
* @param an event listener
|
|
|
|
*/
|
2004-02-10 01:48:53 +03:00
|
|
|
NS_IMETHOD AddScriptEventListener(nsISupports *aObject,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsIAtom *aName,
|
2002-03-24 02:13:20 +03:00
|
|
|
const nsAString& aFunc,
|
2006-06-13 07:07:47 +04:00
|
|
|
PRUint32 aLanguage,
|
2005-04-29 03:48:28 +04:00
|
|
|
PRBool aDeferCompilation,
|
|
|
|
PRBool aPermitUntrustedEvents) = 0;
|
1999-11-28 13:32:13 +03:00
|
|
|
|
2001-05-04 09:34:58 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_IMETHOD RemoveScriptEventListener(nsIAtom *aName) = 0;
|
2001-05-04 09:34:58 +04:00
|
|
|
|
1998-07-31 22:21:37 +04:00
|
|
|
/**
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
* Registers an event listener that already exists on the given
|
2005-04-29 03:48:28 +04:00
|
|
|
* script object with the event listener manager. If the event
|
|
|
|
* listener is registerd from chrome code, the event listener will
|
|
|
|
* only ever receive trusted events.
|
|
|
|
* @param the name of an event listener
|
1998-07-31 22:21:37 +04:00
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_IMETHOD RegisterScriptEventListener(nsIScriptContext *aContext,
|
2006-06-13 07:07:47 +04:00
|
|
|
void *aScopeObject,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsISupports *aObject,
|
|
|
|
nsIAtom* aName) = 0;
|
2001-03-13 14:37:16 +03:00
|
|
|
|
|
|
|
/**
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
* Compiles any event listeners that already exists on the given
|
|
|
|
* script object for a given event type.
|
|
|
|
* @param an event listener */
|
|
|
|
NS_IMETHOD CompileScriptEventListener(nsIScriptContext *aContext,
|
2006-06-13 07:07:47 +04:00
|
|
|
void *aScopeObject,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsISupports *aObject,
|
|
|
|
nsIAtom* aName,
|
|
|
|
PRBool *aDidCompile) = 0;
|
1998-06-07 11:54:32 +04:00
|
|
|
|
1999-07-19 23:54:34 +04:00
|
|
|
/**
|
2006-01-19 05:43:39 +03:00
|
|
|
* Tells the event listener manager that its target (which owns it) is
|
|
|
|
* no longer using it (and could go away).
|
|
|
|
*
|
|
|
|
* It also clears the weak pointer set by the call to
|
|
|
|
* |SetListenerTarget|.
|
1999-07-19 23:54:34 +04:00
|
|
|
*/
|
2006-01-19 05:43:39 +03:00
|
|
|
NS_IMETHOD Disconnect() = 0;
|
2000-05-16 15:35:12 +04:00
|
|
|
|
|
|
|
/**
|
2006-01-19 05:43:39 +03:00
|
|
|
* Tells the event listener manager what its target is. This must be
|
|
|
|
* followed by a call to |Disconnect| before the target is destroyed.
|
2000-05-16 15:35:12 +04:00
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_IMETHOD SetListenerTarget(nsISupports* aTarget) = 0;
|
2000-11-27 10:55:20 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allows us to quickly determine if we have mutation listeners registered.
|
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_IMETHOD HasMutationListeners(PRBool* aListener) = 0;
|
2002-11-09 03:25:25 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the EventGroup registered for use by system event listeners.
|
|
|
|
* This is a special EventGroup which is used in the secondary DOM Event
|
|
|
|
* Loop pass for evaluation of system event listeners.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetSystemEventGroupLM(nsIDOMEventGroup** aGroup) = 0;
|
2005-05-05 00:22:32 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allows us to quickly determine whether we have unload or beforeunload
|
|
|
|
* listeners registered.
|
|
|
|
*/
|
|
|
|
virtual PRBool HasUnloadListeners() = 0;
|
2007-02-01 01:54:24 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the mutation bits depending on which mutation listeners are
|
|
|
|
* registered to this listener manager.
|
|
|
|
* @note If a listener is an nsIDOMMutationListener, all possible mutation
|
2007-03-24 15:18:02 +03:00
|
|
|
* event bits are returned. All bits are also returned if one of the
|
|
|
|
* event listeners is registered to handle DOMSubtreeModified events.
|
2007-02-01 01:54:24 +03:00
|
|
|
*/
|
|
|
|
virtual PRUint32 MutationListenerBits() = 0;
|
2007-05-09 01:13:13 +04:00
|
|
|
|
|
|
|
/**
|
2009-10-16 12:57:32 +04:00
|
|
|
* Sets aList to the list of nsIEventListenerInfo objects representing the
|
|
|
|
* listeners managed by this listener manager.
|
|
|
|
*/
|
|
|
|
virtual nsresult GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList) = 0;
|
|
|
|
|
|
|
|
/**
|
2007-05-09 01:13:13 +04:00
|
|
|
* Returns PR_TRUE if there is at least one event listener for aEventName.
|
|
|
|
*/
|
|
|
|
virtual PRBool HasListenersFor(const nsAString& aEventName) = 0;
|
2008-10-01 04:51:53 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns PR_TRUE if there is at least one event listener.
|
|
|
|
*/
|
|
|
|
virtual PRBool HasListeners() = 0;
|
2008-10-16 01:06:32 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns PR_TRUE if there may be a paint event listener registered,
|
|
|
|
* PR_FALSE if there definitely isn't.
|
|
|
|
*/
|
|
|
|
PRBool MayHavePaintEventListener() { return mMayHavePaintEventListener; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
PRUint32 mMayHavePaintEventListener : 1;
|
|
|
|
PRUint32 mMayHaveMutationListeners : 1;
|
2009-10-24 19:52:29 +04:00
|
|
|
PRUint32 mMayHaveCapturingListeners : 1;
|
|
|
|
PRUint32 mMayHaveSystemGroupListeners : 1;
|
|
|
|
PRUint32 mNoListenerForEvent : 28;
|
1998-06-07 11:54:32 +04:00
|
|
|
};
|
|
|
|
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIEventListenerManager,
|
|
|
|
NS_IEVENTLISTENERMANAGER_IID)
|
|
|
|
|
2003-03-05 18:08:41 +03:00
|
|
|
nsresult
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
1998-07-24 09:06:44 +04:00
|
|
|
|
1998-06-07 11:54:32 +04:00
|
|
|
#endif // nsIEventListenerManager_h__
|