1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nsDOMEvent_h__
39 #define nsDOMEvent_h__
41 #include "nsIDOMEvent.h"
42 #include "nsIDOMNSEvent.h"
43 #include "nsISupports.h"
44 #include "nsIPrivateDOMEvent.h"
46 #include "nsIDOMEventTarget.h"
47 #include "nsPIDOMWindow.h"
48 #include "nsPresContext.h"
50 #include "nsGUIEvent.h"
51 #include "nsCycleCollectionParticipant.h"
54 class nsIScrollableView
;
56 class nsDOMEvent
: public nsIDOMEvent
,
58 public nsIPrivateDOMEvent
62 // Note: this enum must be kept in sync with mEventNames in nsDOMEvent.cpp
64 eDOMEvents_mousedown
=0,
71 eDOMEvents_contextmenu
,
78 eDOMEvents_beforeunload
,
89 eDOMEvents_compositionstart
,
90 eDOMEvents_compositionend
,
91 eDOMEvents_popupShowing
,
92 eDOMEvents_popupShown
,
93 eDOMEvents_popupHiding
,
94 eDOMEvents_popupHidden
,
98 eDOMEvents_commandupdate
,
103 eDOMEvents_draggesture
,
109 eDOMEvents_underflow
,
110 eDOMEvents_overflowchanged
,
111 eDOMEvents_subtreemodified
,
112 eDOMEvents_nodeinserted
,
113 eDOMEvents_noderemoved
,
114 eDOMEvents_noderemovedfromdocument
,
115 eDOMEvents_nodeinsertedintodocument
,
116 eDOMEvents_attrmodified
,
117 eDOMEvents_characterdatamodified
,
118 eDOMEvents_DOMActivate
,
119 eDOMEvents_DOMFocusIn
,
120 eDOMEvents_DOMFocusOut
,
123 eDOMEvents_DOMMouseScroll
,
132 eDOMEvents_SVGUnload
,
135 eDOMEvents_SVGResize
,
136 eDOMEvents_SVGScroll
,
141 nsDOMEvent(nsPresContext
* aPresContext
, nsEvent
* aEvent
);
142 virtual ~nsDOMEvent();
144 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
145 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMEvent
, nsIDOMEvent
)
147 // nsIDOMEvent Interface
150 // nsIDOMNSEvent Interface
151 NS_DECL_NSIDOMNSEVENT
153 // nsIPrivateDOMEvent interface
154 NS_IMETHOD
DuplicatePrivateData();
155 NS_IMETHOD
SetTarget(nsIDOMEventTarget
* aTarget
);
156 NS_IMETHOD
SetCurrentTarget(nsIDOMEventTarget
* aCurrentTarget
);
157 NS_IMETHOD
SetOriginalTarget(nsIDOMEventTarget
* aOriginalTarget
);
158 NS_IMETHOD
IsDispatchStopped(PRBool
* aIsDispatchStopped
);
159 NS_IMETHOD
GetInternalNSEvent(nsEvent
** aNSEvent
);
160 NS_IMETHOD
HasOriginalTarget(PRBool
* aResult
);
161 NS_IMETHOD
SetTrusted(PRBool aTrusted
);
163 static PopupControlState
GetEventPopupControlState(nsEvent
*aEvent
);
165 static void PopupAllowedEventsChanged();
167 static void Shutdown();
171 // Internal helper functions
172 nsresult
SetEventType(const nsAString
& aEventTypeArg
);
173 static const char* GetEventName(PRUint32 aEventType
);
174 already_AddRefed
<nsIDOMEventTarget
> GetTargetFromFrame();
177 nsCOMPtr
<nsPresContext
> mPresContext
;
178 nsCOMPtr
<nsIDOMEventTarget
> mTmpRealOriginalTarget
;
179 nsCOMPtr
<nsIDOMEventTarget
> mExplicitOriginalTarget
;
180 PRPackedBool mEventIsInternal
;
181 PRPackedBool mPrivateDataDuplicated
;
184 #define NS_FORWARD_TO_NSDOMEVENT \
185 NS_FORWARD_NSIDOMEVENT(nsDOMEvent::)
187 #endif // nsDOMEvent_h__