Bumping manifests a=b2g-bump
[gecko.git] / widget / BasicEvents.h
blob873882bccdaf53e131cc5f48ca4c132c0096c44e
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_BasicEvents_h__
7 #define mozilla_BasicEvents_h__
9 #include <stdint.h>
11 #include "mozilla/dom/EventTarget.h"
12 #include "mozilla/EventForwards.h"
13 #include "mozilla/TimeStamp.h"
14 #include "nsCOMPtr.h"
15 #include "nsIAtom.h"
16 #include "nsISupportsImpl.h"
17 #include "nsIWidget.h"
18 #include "nsString.h"
19 #include "Units.h"
21 /******************************************************************************
22 * Messages
24 * TODO: Make them enum.
25 ******************************************************************************/
27 #define NS_EVENT_NULL 0
29 // This is a dummy event message for all event listener implementation in
30 // EventListenerManager.
31 #define NS_EVENT_ALL 1
33 #define NS_WINDOW_START 100
35 // Widget may be destroyed
36 #define NS_XUL_CLOSE (NS_WINDOW_START + 1)
37 // Key is pressed within a window
38 #define NS_KEY_PRESS (NS_WINDOW_START + 31)
39 // Key is released within a window
40 #define NS_KEY_UP (NS_WINDOW_START + 32)
41 // Key is pressed within a window
42 #define NS_KEY_DOWN (NS_WINDOW_START + 33)
44 #define NS_RESIZE_EVENT (NS_WINDOW_START + 60)
45 #define NS_SCROLL_EVENT (NS_WINDOW_START + 61)
47 // A plugin was clicked or otherwise focused. NS_PLUGIN_ACTIVATE should be
48 // used when the window is not active. NS_PLUGIN_FOCUS should be used when
49 // the window is active. In the latter case, the dispatcher of the event
50 // is expected to ensure that the plugin's widget is focused beforehand.
51 #define NS_PLUGIN_ACTIVATE (NS_WINDOW_START + 62)
52 #define NS_PLUGIN_FOCUS (NS_WINDOW_START + 63)
54 #define NS_OFFLINE (NS_WINDOW_START + 64)
55 #define NS_ONLINE (NS_WINDOW_START + 65)
57 // NS_BEFORERESIZE_EVENT used to be here (NS_WINDOW_START + 66)
59 // Indicates that the user is either idle or active
60 #define NS_MOZ_USER_IDLE (NS_WINDOW_START + 67)
61 #define NS_MOZ_USER_ACTIVE (NS_WINDOW_START + 68)
63 // The resolution at which a plugin should draw has changed, for
64 // example as the result of changing from a HiDPI mode to a non-
65 // HiDPI mode.
66 #define NS_PLUGIN_RESOLUTION_CHANGED (NS_WINDOW_START + 69)
68 #define NS_LANGUAGECHANGE (NS_WINDOW_START + 70)
70 #define NS_MOUSE_MESSAGE_START 300
71 #define NS_MOUSE_MOVE (NS_MOUSE_MESSAGE_START)
72 #define NS_MOUSE_BUTTON_UP (NS_MOUSE_MESSAGE_START + 1)
73 #define NS_MOUSE_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 2)
74 #define NS_MOUSE_ENTER (NS_MOUSE_MESSAGE_START + 22)
75 #define NS_MOUSE_EXIT (NS_MOUSE_MESSAGE_START + 23)
76 #define NS_MOUSE_DOUBLECLICK (NS_MOUSE_MESSAGE_START + 24)
77 #define NS_MOUSE_CLICK (NS_MOUSE_MESSAGE_START + 27)
78 #define NS_MOUSE_ACTIVATE (NS_MOUSE_MESSAGE_START + 30)
79 #define NS_MOUSE_ENTER_SYNTH (NS_MOUSE_MESSAGE_START + 31)
80 #define NS_MOUSE_EXIT_SYNTH (NS_MOUSE_MESSAGE_START + 32)
81 #define NS_MOUSE_MOZHITTEST (NS_MOUSE_MESSAGE_START + 33)
82 #define NS_MOUSEENTER (NS_MOUSE_MESSAGE_START + 34)
83 #define NS_MOUSELEAVE (NS_MOUSE_MESSAGE_START + 35)
84 #define NS_MOUSE_MOZLONGTAP (NS_MOUSE_MESSAGE_START + 36)
86 // Pointer spec events
87 #define NS_POINTER_EVENT_START 4400
88 #define NS_POINTER_MOVE (NS_POINTER_EVENT_START)
89 #define NS_POINTER_UP (NS_POINTER_EVENT_START + 1)
90 #define NS_POINTER_DOWN (NS_POINTER_EVENT_START + 2)
91 #define NS_POINTER_OVER (NS_POINTER_EVENT_START + 22)
92 #define NS_POINTER_OUT (NS_POINTER_EVENT_START + 23)
93 #define NS_POINTER_ENTER (NS_POINTER_EVENT_START + 24)
94 #define NS_POINTER_LEAVE (NS_POINTER_EVENT_START + 25)
95 #define NS_POINTER_CANCEL (NS_POINTER_EVENT_START + 26)
96 #define NS_POINTER_GOT_CAPTURE (NS_POINTER_EVENT_START + 27)
97 #define NS_POINTER_LOST_CAPTURE (NS_POINTER_EVENT_START + 28)
99 #define NS_CONTEXTMENU_MESSAGE_START 500
100 #define NS_CONTEXTMENU (NS_CONTEXTMENU_MESSAGE_START)
102 #define NS_STREAM_EVENT_START 1100
103 #define NS_LOAD (NS_STREAM_EVENT_START)
104 #define NS_PAGE_UNLOAD (NS_STREAM_EVENT_START + 1)
105 #define NS_HASHCHANGE (NS_STREAM_EVENT_START + 2)
106 #define NS_IMAGE_ABORT (NS_STREAM_EVENT_START + 3)
107 #define NS_LOAD_ERROR (NS_STREAM_EVENT_START + 4)
108 #define NS_POPSTATE (NS_STREAM_EVENT_START + 5)
109 #define NS_BEFORE_PAGE_UNLOAD (NS_STREAM_EVENT_START + 6)
110 #define NS_PAGE_RESTORE (NS_STREAM_EVENT_START + 7)
111 #define NS_READYSTATECHANGE (NS_STREAM_EVENT_START + 8)
113 #define NS_FORM_EVENT_START 1200
114 #define NS_FORM_SUBMIT (NS_FORM_EVENT_START)
115 #define NS_FORM_RESET (NS_FORM_EVENT_START + 1)
116 #define NS_FORM_CHANGE (NS_FORM_EVENT_START + 2)
117 #define NS_FORM_SELECTED (NS_FORM_EVENT_START + 3)
118 #define NS_FORM_INVALID (NS_FORM_EVENT_START + 4)
120 //Need separate focus/blur notifications for non-native widgets
121 #define NS_FOCUS_EVENT_START 1300
122 #define NS_FOCUS_CONTENT (NS_FOCUS_EVENT_START)
123 #define NS_BLUR_CONTENT (NS_FOCUS_EVENT_START + 1)
125 #define NS_DRAGDROP_EVENT_START 1400
126 #define NS_DRAGDROP_ENTER (NS_DRAGDROP_EVENT_START)
127 #define NS_DRAGDROP_OVER (NS_DRAGDROP_EVENT_START + 1)
128 #define NS_DRAGDROP_EXIT (NS_DRAGDROP_EVENT_START + 2)
129 #define NS_DRAGDROP_DRAGDROP (NS_DRAGDROP_EVENT_START + 3)
130 #define NS_DRAGDROP_GESTURE (NS_DRAGDROP_EVENT_START + 4)
131 #define NS_DRAGDROP_DRAG (NS_DRAGDROP_EVENT_START + 5)
132 #define NS_DRAGDROP_END (NS_DRAGDROP_EVENT_START + 6)
133 #define NS_DRAGDROP_START (NS_DRAGDROP_EVENT_START + 7)
134 #define NS_DRAGDROP_DROP (NS_DRAGDROP_EVENT_START + 8)
135 #define NS_DRAGDROP_OVER_SYNTH (NS_DRAGDROP_EVENT_START + 1)
136 #define NS_DRAGDROP_EXIT_SYNTH (NS_DRAGDROP_EVENT_START + 2)
137 #define NS_DRAGDROP_LEAVE_SYNTH (NS_DRAGDROP_EVENT_START + 9)
139 // Events for popups
140 #define NS_XUL_EVENT_START 1500
141 #define NS_XUL_POPUP_SHOWING (NS_XUL_EVENT_START)
142 #define NS_XUL_POPUP_SHOWN (NS_XUL_EVENT_START+1)
143 #define NS_XUL_POPUP_HIDING (NS_XUL_EVENT_START+2)
144 #define NS_XUL_POPUP_HIDDEN (NS_XUL_EVENT_START+3)
145 // NS_XUL_COMMAND used to be here (NS_XUL_EVENT_START+4)
146 #define NS_XUL_BROADCAST (NS_XUL_EVENT_START+5)
147 #define NS_XUL_COMMAND_UPDATE (NS_XUL_EVENT_START+6)
148 //@}
150 // Scroll events
151 #define NS_MOUSE_SCROLL_START 1600
152 #define NS_MOUSE_SCROLL (NS_MOUSE_SCROLL_START)
153 #define NS_MOUSE_PIXEL_SCROLL (NS_MOUSE_SCROLL_START + 1)
155 #define NS_SCROLLPORT_START 1700
156 #define NS_SCROLLPORT_UNDERFLOW (NS_SCROLLPORT_START)
157 #define NS_SCROLLPORT_OVERFLOW (NS_SCROLLPORT_START+1)
159 #define NS_MUTATION_START 1800
160 #define NS_MUTATION_SUBTREEMODIFIED (NS_MUTATION_START)
161 #define NS_MUTATION_NODEINSERTED (NS_MUTATION_START+1)
162 #define NS_MUTATION_NODEREMOVED (NS_MUTATION_START+2)
163 #define NS_MUTATION_NODEREMOVEDFROMDOCUMENT (NS_MUTATION_START+3)
164 #define NS_MUTATION_NODEINSERTEDINTODOCUMENT (NS_MUTATION_START+4)
165 #define NS_MUTATION_ATTRMODIFIED (NS_MUTATION_START+5)
166 #define NS_MUTATION_CHARACTERDATAMODIFIED (NS_MUTATION_START+6)
167 #define NS_MUTATION_END (NS_MUTATION_START+6)
169 #define NS_USER_DEFINED_EVENT 2000
171 // composition events
172 #define NS_COMPOSITION_EVENT_START 2200
173 #define NS_COMPOSITION_START (NS_COMPOSITION_EVENT_START)
174 #define NS_COMPOSITION_END (NS_COMPOSITION_EVENT_START + 1)
175 #define NS_COMPOSITION_UPDATE (NS_COMPOSITION_EVENT_START + 2)
177 // text events
178 #define NS_TEXT_START 2400
179 #define NS_TEXT_TEXT (NS_TEXT_START)
181 // UI events
182 #define NS_UI_EVENT_START 2500
183 // this is not to be confused with NS_ACTIVATE!
184 #define NS_UI_ACTIVATE (NS_UI_EVENT_START)
185 #define NS_UI_FOCUSIN (NS_UI_EVENT_START + 1)
186 #define NS_UI_FOCUSOUT (NS_UI_EVENT_START + 2)
188 // pagetransition events
189 #define NS_PAGETRANSITION_START 2700
190 #define NS_PAGE_SHOW (NS_PAGETRANSITION_START + 1)
191 #define NS_PAGE_HIDE (NS_PAGETRANSITION_START + 2)
193 // SVG events
194 #define NS_SVG_EVENT_START 2800
195 #define NS_SVG_LOAD (NS_SVG_EVENT_START)
196 #define NS_SVG_UNLOAD (NS_SVG_EVENT_START + 1)
197 #define NS_SVG_ABORT (NS_SVG_EVENT_START + 2)
198 #define NS_SVG_ERROR (NS_SVG_EVENT_START + 3)
199 #define NS_SVG_RESIZE (NS_SVG_EVENT_START + 4)
200 #define NS_SVG_SCROLL (NS_SVG_EVENT_START + 5)
202 // SVG Zoom events
203 #define NS_SVGZOOM_EVENT_START 2900
204 #define NS_SVG_ZOOM (NS_SVGZOOM_EVENT_START)
206 // XUL command events
207 #define NS_XULCOMMAND_EVENT_START 3000
208 #define NS_XUL_COMMAND (NS_XULCOMMAND_EVENT_START)
210 // Cut, copy, paste events
211 #define NS_CUTCOPYPASTE_EVENT_START 3100
212 #define NS_COPY (NS_CUTCOPYPASTE_EVENT_START)
213 #define NS_CUT (NS_CUTCOPYPASTE_EVENT_START + 1)
214 #define NS_PASTE (NS_CUTCOPYPASTE_EVENT_START + 2)
216 // Query the content information
217 #define NS_QUERY_CONTENT_EVENT_START 3200
218 // Query for the selected text information, it return the selection offset,
219 // selection length and selected text.
220 #define NS_QUERY_SELECTED_TEXT (NS_QUERY_CONTENT_EVENT_START)
221 // Query for the text content of specified range, it returns actual lengh (if
222 // the specified range is too long) and the text of the specified range.
223 // Returns the entire text if requested length > actual length.
224 #define NS_QUERY_TEXT_CONTENT (NS_QUERY_CONTENT_EVENT_START + 1)
225 // Query for the caret rect of nth insertion point. The offset of the result is
226 // relative position from the top level widget.
227 #define NS_QUERY_CARET_RECT (NS_QUERY_CONTENT_EVENT_START + 3)
228 // Query for the bounding rect of a range of characters. This works on any
229 // valid character range given offset and length. Result is relative to top
230 // level widget coordinates
231 #define NS_QUERY_TEXT_RECT (NS_QUERY_CONTENT_EVENT_START + 4)
232 // Query for the bounding rect of the current focused frame. Result is relative
233 // to top level widget coordinates
234 #define NS_QUERY_EDITOR_RECT (NS_QUERY_CONTENT_EVENT_START + 5)
235 // Query for the current state of the content. The particular members of
236 // mReply that are set for each query content event will be valid on success.
237 #define NS_QUERY_CONTENT_STATE (NS_QUERY_CONTENT_EVENT_START + 6)
238 // Query for the selection in the form of a nsITransferable.
239 #define NS_QUERY_SELECTION_AS_TRANSFERABLE (NS_QUERY_CONTENT_EVENT_START + 7)
240 // Query for character at a point. This returns the character offset and its
241 // rect. The point is specified by Event::refPoint.
242 #define NS_QUERY_CHARACTER_AT_POINT (NS_QUERY_CONTENT_EVENT_START + 8)
243 // Query if the DOM element under Event::refPoint belongs to our widget
244 // or not.
245 #define NS_QUERY_DOM_WIDGET_HITTEST (NS_QUERY_CONTENT_EVENT_START + 9)
247 // Video events
248 #define NS_MEDIA_EVENT_START 3300
249 #define NS_LOADSTART (NS_MEDIA_EVENT_START)
250 #define NS_PROGRESS (NS_MEDIA_EVENT_START+1)
251 #define NS_SUSPEND (NS_MEDIA_EVENT_START+2)
252 #define NS_EMPTIED (NS_MEDIA_EVENT_START+3)
253 #define NS_STALLED (NS_MEDIA_EVENT_START+4)
254 #define NS_PLAY (NS_MEDIA_EVENT_START+5)
255 #define NS_PAUSE (NS_MEDIA_EVENT_START+6)
256 #define NS_LOADEDMETADATA (NS_MEDIA_EVENT_START+7)
257 #define NS_LOADEDDATA (NS_MEDIA_EVENT_START+8)
258 #define NS_WAITING (NS_MEDIA_EVENT_START+9)
259 #define NS_PLAYING (NS_MEDIA_EVENT_START+10)
260 #define NS_CANPLAY (NS_MEDIA_EVENT_START+11)
261 #define NS_CANPLAYTHROUGH (NS_MEDIA_EVENT_START+12)
262 #define NS_SEEKING (NS_MEDIA_EVENT_START+13)
263 #define NS_SEEKED (NS_MEDIA_EVENT_START+14)
264 #define NS_TIMEUPDATE (NS_MEDIA_EVENT_START+15)
265 #define NS_ENDED (NS_MEDIA_EVENT_START+16)
266 #define NS_RATECHANGE (NS_MEDIA_EVENT_START+17)
267 #define NS_DURATIONCHANGE (NS_MEDIA_EVENT_START+18)
268 #define NS_VOLUMECHANGE (NS_MEDIA_EVENT_START+19)
269 #define NS_NEED_KEY (NS_MEDIA_EVENT_START+20)
271 // paint notification events
272 #define NS_NOTIFYPAINT_START 3400
273 #define NS_AFTERPAINT (NS_NOTIFYPAINT_START)
275 // Simple gesture events
276 #define NS_SIMPLE_GESTURE_EVENT_START 3500
277 #define NS_SIMPLE_GESTURE_SWIPE_START (NS_SIMPLE_GESTURE_EVENT_START)
278 #define NS_SIMPLE_GESTURE_SWIPE_UPDATE (NS_SIMPLE_GESTURE_EVENT_START+1)
279 #define NS_SIMPLE_GESTURE_SWIPE_END (NS_SIMPLE_GESTURE_EVENT_START+2)
280 #define NS_SIMPLE_GESTURE_SWIPE (NS_SIMPLE_GESTURE_EVENT_START+3)
281 #define NS_SIMPLE_GESTURE_MAGNIFY_START (NS_SIMPLE_GESTURE_EVENT_START+4)
282 #define NS_SIMPLE_GESTURE_MAGNIFY_UPDATE (NS_SIMPLE_GESTURE_EVENT_START+5)
283 #define NS_SIMPLE_GESTURE_MAGNIFY (NS_SIMPLE_GESTURE_EVENT_START+6)
284 #define NS_SIMPLE_GESTURE_ROTATE_START (NS_SIMPLE_GESTURE_EVENT_START+7)
285 #define NS_SIMPLE_GESTURE_ROTATE_UPDATE (NS_SIMPLE_GESTURE_EVENT_START+8)
286 #define NS_SIMPLE_GESTURE_ROTATE (NS_SIMPLE_GESTURE_EVENT_START+9)
287 #define NS_SIMPLE_GESTURE_TAP (NS_SIMPLE_GESTURE_EVENT_START+10)
288 #define NS_SIMPLE_GESTURE_PRESSTAP (NS_SIMPLE_GESTURE_EVENT_START+11)
289 #define NS_SIMPLE_GESTURE_EDGE_STARTED (NS_SIMPLE_GESTURE_EVENT_START+12)
290 #define NS_SIMPLE_GESTURE_EDGE_CANCELED (NS_SIMPLE_GESTURE_EVENT_START+13)
291 #define NS_SIMPLE_GESTURE_EDGE_COMPLETED (NS_SIMPLE_GESTURE_EVENT_START+14)
293 // These are used to send native events to plugins.
294 #define NS_PLUGIN_EVENT_START 3600
295 #define NS_PLUGIN_INPUT_EVENT (NS_PLUGIN_EVENT_START)
296 #define NS_PLUGIN_FOCUS_EVENT (NS_PLUGIN_EVENT_START+1)
298 // Events to manipulate selection (WidgetSelectionEvent)
299 #define NS_SELECTION_EVENT_START 3700
300 // Clear any previous selection and set the given range as the selection
301 #define NS_SELECTION_SET (NS_SELECTION_EVENT_START)
303 // Events of commands for the contents
304 #define NS_CONTENT_COMMAND_EVENT_START 3800
305 #define NS_CONTENT_COMMAND_CUT (NS_CONTENT_COMMAND_EVENT_START)
306 #define NS_CONTENT_COMMAND_COPY (NS_CONTENT_COMMAND_EVENT_START+1)
307 #define NS_CONTENT_COMMAND_PASTE (NS_CONTENT_COMMAND_EVENT_START+2)
308 #define NS_CONTENT_COMMAND_DELETE (NS_CONTENT_COMMAND_EVENT_START+3)
309 #define NS_CONTENT_COMMAND_UNDO (NS_CONTENT_COMMAND_EVENT_START+4)
310 #define NS_CONTENT_COMMAND_REDO (NS_CONTENT_COMMAND_EVENT_START+5)
311 #define NS_CONTENT_COMMAND_PASTE_TRANSFERABLE (NS_CONTENT_COMMAND_EVENT_START+6)
312 // NS_CONTENT_COMMAND_SCROLL scrolls the nearest scrollable element to the
313 // currently focused content or latest DOM selection. This would normally be
314 // the same element scrolled by keyboard scroll commands, except that this event
315 // will scroll an element scrollable in either direction. I.e., if the nearest
316 // scrollable ancestor element can only be scrolled vertically, and horizontal
317 // scrolling is requested using this event, no scrolling will occur.
318 #define NS_CONTENT_COMMAND_SCROLL (NS_CONTENT_COMMAND_EVENT_START+7)
320 // Event to gesture notification
321 #define NS_GESTURENOTIFY_EVENT_START 3900
323 #define NS_ORIENTATION_EVENT 4000
325 #define NS_SCROLLAREA_EVENT_START 4100
326 #define NS_SCROLLEDAREACHANGED (NS_SCROLLAREA_EVENT_START)
328 #define NS_TRANSITION_EVENT_START 4200
329 #define NS_TRANSITION_END (NS_TRANSITION_EVENT_START)
331 #define NS_ANIMATION_EVENT_START 4250
332 #define NS_ANIMATION_START (NS_ANIMATION_EVENT_START)
333 #define NS_ANIMATION_END (NS_ANIMATION_EVENT_START + 1)
334 #define NS_ANIMATION_ITERATION (NS_ANIMATION_EVENT_START + 2)
336 #define NS_SMIL_TIME_EVENT_START 4300
337 #define NS_SMIL_BEGIN (NS_SMIL_TIME_EVENT_START)
338 #define NS_SMIL_END (NS_SMIL_TIME_EVENT_START + 1)
339 #define NS_SMIL_REPEAT (NS_SMIL_TIME_EVENT_START + 2)
341 #define NS_WEBAUDIO_EVENT_START 4350
342 #define NS_AUDIO_PROCESS (NS_WEBAUDIO_EVENT_START)
343 #define NS_AUDIO_COMPLETE (NS_WEBAUDIO_EVENT_START + 1)
345 // script notification events
346 #define NS_NOTIFYSCRIPT_START 4500
347 #define NS_BEFORE_SCRIPT_EXECUTE (NS_NOTIFYSCRIPT_START)
348 #define NS_AFTER_SCRIPT_EXECUTE (NS_NOTIFYSCRIPT_START+1)
350 #define NS_PRINT_EVENT_START 4600
351 #define NS_BEFOREPRINT (NS_PRINT_EVENT_START)
352 #define NS_AFTERPRINT (NS_PRINT_EVENT_START + 1)
354 #define NS_MESSAGE_EVENT_START 4700
355 #define NS_MESSAGE (NS_MESSAGE_EVENT_START)
357 // Open and close events
358 #define NS_OPENCLOSE_EVENT_START 4800
359 #define NS_OPEN (NS_OPENCLOSE_EVENT_START)
360 #define NS_CLOSE (NS_OPENCLOSE_EVENT_START+1)
362 // Device motion and orientation
363 #define NS_DEVICE_ORIENTATION_START 4900
364 #define NS_DEVICE_ORIENTATION (NS_DEVICE_ORIENTATION_START)
365 #define NS_DEVICE_MOTION (NS_DEVICE_ORIENTATION_START+1)
366 #define NS_DEVICE_PROXIMITY (NS_DEVICE_ORIENTATION_START+2)
367 #define NS_USER_PROXIMITY (NS_DEVICE_ORIENTATION_START+3)
368 #define NS_DEVICE_LIGHT (NS_DEVICE_ORIENTATION_START+4)
370 #define NS_SHOW_EVENT 5000
372 // Fullscreen DOM API
373 #define NS_FULL_SCREEN_START 5100
374 #define NS_FULLSCREENCHANGE (NS_FULL_SCREEN_START)
375 #define NS_FULLSCREENERROR (NS_FULL_SCREEN_START + 1)
377 #define NS_TOUCH_EVENT_START 5200
378 #define NS_TOUCH_START (NS_TOUCH_EVENT_START)
379 #define NS_TOUCH_MOVE (NS_TOUCH_EVENT_START+1)
380 #define NS_TOUCH_END (NS_TOUCH_EVENT_START+2)
381 #define NS_TOUCH_CANCEL (NS_TOUCH_EVENT_START+3)
383 // Pointerlock DOM API
384 #define NS_POINTERLOCK_START 5300
385 #define NS_POINTERLOCKCHANGE (NS_POINTERLOCK_START)
386 #define NS_POINTERLOCKERROR (NS_POINTERLOCK_START + 1)
388 #define NS_WHEEL_EVENT_START 5400
389 #define NS_WHEEL_WHEEL (NS_WHEEL_EVENT_START)
390 #define NS_WHEEL_START (NS_WHEEL_EVENT_START + 1)
391 #define NS_WHEEL_STOP (NS_WHEEL_EVENT_START + 2)
393 //System time is changed
394 #define NS_MOZ_TIME_CHANGE_EVENT 5500
396 // Network packet events.
397 #define NS_NETWORK_EVENT_START 5600
398 #define NS_NETWORK_UPLOAD_EVENT (NS_NETWORK_EVENT_START + 1)
399 #define NS_NETWORK_DOWNLOAD_EVENT (NS_NETWORK_EVENT_START + 2)
401 // MediaRecorder events.
402 #define NS_MEDIARECORDER_EVENT_START 5700
403 #define NS_MEDIARECORDER_DATAAVAILABLE (NS_MEDIARECORDER_EVENT_START + 1)
404 #define NS_MEDIARECORDER_WARNING (NS_MEDIARECORDER_EVENT_START + 2)
405 #define NS_MEDIARECORDER_STOP (NS_MEDIARECORDER_EVENT_START + 3)
407 // SpeakerManager events
408 #define NS_SPEAKERMANAGER_EVENT_START 5800
409 #define NS_SPEAKERMANAGER_SPEAKERFORCEDCHANGE (NS_SPEAKERMANAGER_EVENT_START + 1)
411 #ifdef MOZ_GAMEPAD
412 // Gamepad input events
413 #define NS_GAMEPAD_START 6000
414 #define NS_GAMEPAD_BUTTONDOWN (NS_GAMEPAD_START)
415 #define NS_GAMEPAD_BUTTONUP (NS_GAMEPAD_START+1)
416 #define NS_GAMEPAD_AXISMOVE (NS_GAMEPAD_START+2)
417 #define NS_GAMEPAD_CONNECTED (NS_GAMEPAD_START+3)
418 #define NS_GAMEPAD_DISCONNECTED (NS_GAMEPAD_START+4)
419 // Keep this defined to the same value as the event above
420 #define NS_GAMEPAD_END (NS_GAMEPAD_START+4)
421 #endif
423 // input and beforeinput events.
424 #define NS_EDITOR_EVENT_START 6100
425 #define NS_EDITOR_INPUT (NS_EDITOR_EVENT_START)
427 namespace IPC {
428 template<typename T>
429 struct ParamTraits;
432 namespace mozilla {
434 /******************************************************************************
435 * mozilla::BaseEventFlags
437 * BaseEventFlags must be a POD struct for safe to use memcpy (including
438 * in ParamTraits<BaseEventFlags>). So don't make virtual methods, constructor,
439 * destructor and operators.
440 * This is necessary for VC which is NOT C++0x compiler.
441 ******************************************************************************/
443 struct BaseEventFlags
445 public:
446 // If mIsTrusted is true, the event is a trusted event. Otherwise, it's
447 // an untrusted event.
448 bool mIsTrusted : 1;
449 // If mInBubblingPhase is true, the event is in bubbling phase or target
450 // phase.
451 bool mInBubblingPhase : 1;
452 // If mInCapturePhase is true, the event is in capture phase or target phase.
453 bool mInCapturePhase : 1;
454 // If mInSystemGroup is true, the event is being dispatched in system group.
455 bool mInSystemGroup: 1;
456 // If mCancelable is true, the event can be consumed. I.e., calling
457 // dom::Event::PreventDefault() can prevent the default action.
458 bool mCancelable : 1;
459 // If mBubbles is true, the event can bubble. Otherwise, cannot be handled
460 // in bubbling phase.
461 bool mBubbles : 1;
462 // If mPropagationStopped is true, dom::Event::StopPropagation() or
463 // dom::Event::StopImmediatePropagation() has been called.
464 bool mPropagationStopped : 1;
465 // If mImmediatePropagationStopped is true,
466 // dom::Event::StopImmediatePropagation() has been called.
467 // Note that mPropagationStopped must be true when this is true.
468 bool mImmediatePropagationStopped : 1;
469 // If mDefaultPrevented is true, the event has been consumed.
470 // E.g., dom::Event::PreventDefault() has been called or
471 // the default action has been performed.
472 bool mDefaultPrevented : 1;
473 // If mDefaultPreventedByContent is true, the event has been
474 // consumed by content.
475 // Note that mDefaultPrevented must be true when this is true.
476 bool mDefaultPreventedByContent : 1;
477 // mMultipleActionsPrevented may be used when default handling don't want to
478 // be prevented, but only one of the event targets should handle the event.
479 // For example, when a <label> element is in another <label> element and
480 // the first <label> element is clicked, that one may set this true.
481 // Then, the second <label> element won't handle the event.
482 bool mMultipleActionsPrevented : 1;
483 // If mIsBeingDispatched is true, the DOM event created from the event is
484 // dispatching into the DOM tree and not completed.
485 bool mIsBeingDispatched : 1;
486 // If mDispatchedAtLeastOnce is true, the event has been dispatched
487 // as a DOM event and the dispatch has been completed.
488 bool mDispatchedAtLeastOnce : 1;
489 // If mIsSynthesizedForTests is true, the event has been synthesized for
490 // automated tests or something hacky approach of an add-on.
491 bool mIsSynthesizedForTests : 1;
492 // If mExceptionHasBeenRisen is true, one of the event handlers has risen an
493 // exception.
494 bool mExceptionHasBeenRisen : 1;
495 // If mRetargetToNonNativeAnonymous is true and the target is in a non-native
496 // native anonymous subtree, the event target is set to originalTarget.
497 bool mRetargetToNonNativeAnonymous : 1;
498 // If mNoCrossProcessBoundaryForwarding is true, the event is not allowed to
499 // cross process boundary.
500 bool mNoCrossProcessBoundaryForwarding : 1;
501 // If mNoContentDispatch is true, the event is never dispatched to the
502 // event handlers which are added to the contents, onfoo attributes and
503 // properties. Note that this flag is ignored when
504 // EventChainPreVisitor::mForceContentDispatch is set true. For exapmle,
505 // window and document object sets it true. Therefore, web applications
506 // can handle the event if they add event listeners to the window or the
507 // document.
508 bool mNoContentDispatch : 1;
509 // If mOnlyChromeDispatch is true, the event is dispatched to only chrome.
510 bool mOnlyChromeDispatch : 1;
511 // If mWantReplyFromContentProcess is true, the event will be redispatched
512 // in the parent process after the content process has handled it. Useful
513 // for when the parent process need the know first how the event was used
514 // by content before handling it itself.
515 bool mWantReplyFromContentProcess : 1;
517 // If the event is being handled in target phase, returns true.
518 inline bool InTargetPhase() const
520 return (mInBubblingPhase && mInCapturePhase);
523 inline void Clear()
525 SetRawFlags(0);
527 // Get if either the instance's bit or the aOther's bit is true, the
528 // instance's bit becomes true. In other words, this works like:
529 // eventFlags |= aOther;
530 inline void Union(const BaseEventFlags& aOther)
532 RawFlags rawFlags = GetRawFlags() | aOther.GetRawFlags();
533 SetRawFlags(rawFlags);
536 private:
537 typedef uint32_t RawFlags;
539 inline void SetRawFlags(RawFlags aRawFlags)
541 static_assert(sizeof(BaseEventFlags) <= sizeof(RawFlags),
542 "mozilla::EventFlags must not be bigger than the RawFlags");
543 memcpy(this, &aRawFlags, sizeof(BaseEventFlags));
545 inline RawFlags GetRawFlags() const
547 RawFlags result = 0;
548 memcpy(&result, this, sizeof(BaseEventFlags));
549 return result;
553 /******************************************************************************
554 * mozilla::EventFlags
555 ******************************************************************************/
557 struct EventFlags : public BaseEventFlags
559 EventFlags()
561 Clear();
565 /******************************************************************************
566 * mozilla::WidgetEvent
567 ******************************************************************************/
569 class WidgetEvent
571 protected:
572 WidgetEvent(bool aIsTrusted, uint32_t aMessage, EventClassID aEventClassID)
573 : mClass(aEventClassID)
574 , message(aMessage)
575 , refPoint(0, 0)
576 , lastRefPoint(0, 0)
577 , time(0)
578 , timeStamp(TimeStamp::Now())
579 , userType(nullptr)
581 MOZ_COUNT_CTOR(WidgetEvent);
582 mFlags.Clear();
583 mFlags.mIsTrusted = aIsTrusted;
584 mFlags.mCancelable = true;
585 mFlags.mBubbles = true;
588 WidgetEvent()
590 MOZ_COUNT_CTOR(WidgetEvent);
593 public:
594 WidgetEvent(bool aIsTrusted, uint32_t aMessage)
595 : mClass(eBasicEventClass)
596 , message(aMessage)
597 , refPoint(0, 0)
598 , lastRefPoint(0, 0)
599 , time(0)
600 , timeStamp(TimeStamp::Now())
601 , userType(nullptr)
603 MOZ_COUNT_CTOR(WidgetEvent);
604 mFlags.Clear();
605 mFlags.mIsTrusted = aIsTrusted;
606 mFlags.mCancelable = true;
607 mFlags.mBubbles = true;
610 virtual ~WidgetEvent()
612 MOZ_COUNT_DTOR(WidgetEvent);
615 WidgetEvent(const WidgetEvent& aOther)
617 MOZ_COUNT_CTOR(WidgetEvent);
618 *this = aOther;
621 virtual WidgetEvent* Duplicate() const
623 MOZ_ASSERT(mClass == eBasicEventClass,
624 "Duplicate() must be overridden by sub class");
625 WidgetEvent* result = new WidgetEvent(false, message);
626 result->AssignEventData(*this, true);
627 result->mFlags = mFlags;
628 return result;
631 EventClassID mClass;
632 // See GUI MESSAGES,
633 uint32_t message;
634 // Relative to the widget of the event, or if there is no widget then it is
635 // in screen coordinates. Not modified by layout code.
636 LayoutDeviceIntPoint refPoint;
637 // The previous refPoint, if known, used to calculate mouse movement deltas.
638 LayoutDeviceIntPoint lastRefPoint;
639 // Elapsed time, in milliseconds, from a platform-specific zero time
640 // to the time the message was created
641 uint64_t time;
642 // Timestamp when the message was created. Set in parallel to 'time' until we
643 // determine if it is safe to drop 'time' (see bug 77992).
644 mozilla::TimeStamp timeStamp;
645 // See BaseEventFlags definition for the detail.
646 BaseEventFlags mFlags;
648 // Additional type info for user defined events
649 nsCOMPtr<nsIAtom> userType;
651 nsString typeString; // always set on non-main-thread events
653 // Event targets, needed by DOM Events
654 nsCOMPtr<dom::EventTarget> target;
655 nsCOMPtr<dom::EventTarget> currentTarget;
656 nsCOMPtr<dom::EventTarget> originalTarget;
658 void AssignEventData(const WidgetEvent& aEvent, bool aCopyTargets)
660 // mClass should be initialized with the constructor.
661 // message should be initialized with the constructor.
662 refPoint = aEvent.refPoint;
663 // lastRefPoint doesn't need to be copied.
664 time = aEvent.time;
665 timeStamp = aEvent.timeStamp;
666 // mFlags should be copied manually if it's necessary.
667 userType = aEvent.userType;
668 // typeString should be copied manually if it's necessary.
669 target = aCopyTargets ? aEvent.target : nullptr;
670 currentTarget = aCopyTargets ? aEvent.currentTarget : nullptr;
671 originalTarget = aCopyTargets ? aEvent.originalTarget : nullptr;
675 * Utils for checking event types
679 * As*Event() returns the pointer of the instance only when the instance is
680 * the class or one of its derived class.
682 #define NS_ROOT_EVENT_CLASS(aPrefix, aName)
683 #define NS_EVENT_CLASS(aPrefix, aName) \
684 virtual aPrefix##aName* As##aName(); \
685 const aPrefix##aName* As##aName() const;
687 #include "mozilla/EventClassList.h"
689 #undef NS_EVENT_CLASS
690 #undef NS_ROOT_EVENT_CLASS
693 * Returns true if the event is a query content event.
695 bool IsQueryContentEvent() const;
697 * Returns true if the event is a selection event.
699 bool IsSelectionEvent() const;
701 * Returns true if the event is a content command event.
703 bool IsContentCommandEvent() const;
705 * Returns true if the event is a native event deliverer event for plugin.
707 bool IsNativeEventDelivererForPlugin() const;
710 * Returns true if the event message is one of mouse events.
712 bool HasMouseEventMessage() const;
714 * Returns true if the event message is one of drag events.
716 bool HasDragEventMessage() const;
718 * Returns true if the event message is one of key events.
720 bool HasKeyEventMessage() const;
722 * Returns true if the event message is one of composition events or text
723 * event.
725 bool HasIMEEventMessage() const;
727 * Returns true if the event message is one of plugin activation events.
729 bool HasPluginActivationEventMessage() const;
732 * Returns true if the event is native event deliverer event for plugin and
733 * it should be retarted to focused document.
735 bool IsRetargetedNativeEventDelivererForPlugin() const;
737 * Returns true if the event is native event deliverer event for plugin and
738 * it should NOT be retarted to focused document.
740 bool IsNonRetargetedNativeEventDelivererForPlugin() const;
742 * Returns true if the event is related to IME handling. It includes
743 * IME events, query content events and selection events.
744 * Be careful when you use this.
746 bool IsIMERelatedEvent() const;
749 * Whether the event should be handled by the frame of the mouse cursor
750 * position or not. When it should be handled there (e.g., the mouse events),
751 * this returns true.
753 bool IsUsingCoordinates() const;
755 * Whether the event should be handled by the focused DOM window in the
756 * same top level window's or not. E.g., key events, IME related events
757 * (including the query content events, they are used in IME transaction)
758 * should be handled by the (last) focused window rather than the dispatched
759 * window.
761 * NOTE: Even if this returns true, the event isn't going to be handled by the
762 * application level active DOM window which is on another top level window.
763 * So, when the event is fired on a deactive window, the event is going to be
764 * handled by the last focused DOM window in the last focused window.
766 bool IsTargetedAtFocusedWindow() const;
768 * Whether the event should be handled by the focused content or not. E.g.,
769 * key events, IME related events and other input events which are not handled
770 * by the frame of the mouse cursor position.
772 * NOTE: Even if this returns true, the event isn't going to be handled by the
773 * application level active DOM window which is on another top level window.
774 * So, when the event is fired on a deactive window, the event is going to be
775 * handled by the last focused DOM element of the last focused DOM window in
776 * the last focused window.
778 bool IsTargetedAtFocusedContent() const;
780 * Whether the event should cause a DOM event.
782 bool IsAllowedToDispatchDOMEvent() const;
785 /******************************************************************************
786 * mozilla::WidgetGUIEvent
787 ******************************************************************************/
789 class WidgetGUIEvent : public WidgetEvent
791 protected:
792 WidgetGUIEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
793 EventClassID aEventClassID)
794 : WidgetEvent(aIsTrusted, aMessage, aEventClassID)
795 , widget(aWidget)
799 WidgetGUIEvent()
803 public:
804 virtual WidgetGUIEvent* AsGUIEvent() MOZ_OVERRIDE { return this; }
806 WidgetGUIEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget) :
807 WidgetEvent(aIsTrusted, aMessage, eGUIEventClass),
808 widget(aWidget)
812 virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
814 MOZ_ASSERT(mClass == eGUIEventClass,
815 "Duplicate() must be overridden by sub class");
816 // Not copying widget, it is a weak reference.
817 WidgetGUIEvent* result = new WidgetGUIEvent(false, message, nullptr);
818 result->AssignGUIEventData(*this, true);
819 result->mFlags = mFlags;
820 return result;
823 /// Originator of the event
824 nsCOMPtr<nsIWidget> widget;
827 * Explanation for this PluginEvent class:
829 * WidgetGUIEvent's mPluginEvent member used to be a void* pointer,
830 * used to reference external, OS-specific data structures.
832 * That void* pointer wasn't serializable by itself, causing
833 * certain plugin events not to function in e10s. See bug 586656.
835 * To make this serializable, we changed this void* pointer into
836 * a proper buffer, and copy these external data structures into this
837 * buffer.
839 * That buffer is PluginEvent::mBuffer below.
841 * We wrap this in that PluginEvent class providing operators to
842 * be compatible with existing code that was written around
843 * the old void* field.
845 * Ideally though, we wouldn't allow arbitrary reinterpret_cast'ing here;
846 * instead, we would at least store type information here so that
847 * this class can't be used to reinterpret one structure type into another.
848 * We can also wonder if it would be possible to properly extend
849 * WidgetGUIEvent and other Event classes to remove the need for this
850 * mPluginEvent field.
852 class PluginEvent MOZ_FINAL
854 nsTArray<uint8_t> mBuffer;
856 friend struct IPC::ParamTraits<mozilla::WidgetGUIEvent>;
858 public:
860 MOZ_EXPLICIT_CONVERSION operator bool() const
862 return !mBuffer.IsEmpty();
865 template<typename T>
866 MOZ_EXPLICIT_CONVERSION operator const T*() const
868 return mBuffer.IsEmpty()
869 ? nullptr
870 : reinterpret_cast<const T*>(mBuffer.Elements());
873 template <typename T>
874 void Copy(const T& other)
876 static_assert(!mozilla::IsPointer<T>::value, "Don't want a pointer!");
877 mBuffer.SetLength(sizeof(T));
878 memcpy(mBuffer.Elements(), &other, mBuffer.Length());
881 void Clear()
883 mBuffer.Clear();
887 /// Event for NPAPI plugin
888 PluginEvent mPluginEvent;
890 void AssignGUIEventData(const WidgetGUIEvent& aEvent, bool aCopyTargets)
892 AssignEventData(aEvent, aCopyTargets);
894 // widget should be initialized with the constructor.
896 mPluginEvent = aEvent.mPluginEvent;
900 /******************************************************************************
901 * mozilla::Modifier
903 * All modifier keys should be defined here. This is used for managing
904 * modifier states for DOM Level 3 or later.
905 ******************************************************************************/
907 enum Modifier
909 MODIFIER_NONE = 0x0000,
910 MODIFIER_ALT = 0x0001,
911 MODIFIER_ALTGRAPH = 0x0002,
912 MODIFIER_CAPSLOCK = 0x0004,
913 MODIFIER_CONTROL = 0x0008,
914 MODIFIER_FN = 0x0010,
915 MODIFIER_META = 0x0020,
916 MODIFIER_NUMLOCK = 0x0040,
917 MODIFIER_SCROLLLOCK = 0x0080,
918 MODIFIER_SHIFT = 0x0100,
919 MODIFIER_SYMBOLLOCK = 0x0200,
920 MODIFIER_OS = 0x0400
923 /******************************************************************************
924 * Modifier key names.
925 ******************************************************************************/
927 #define NS_DOM_KEYNAME_ALT "Alt"
928 #define NS_DOM_KEYNAME_ALTGRAPH "AltGraph"
929 #define NS_DOM_KEYNAME_CAPSLOCK "CapsLock"
930 #define NS_DOM_KEYNAME_CONTROL "Control"
931 #define NS_DOM_KEYNAME_FN "Fn"
932 #define NS_DOM_KEYNAME_META "Meta"
933 #define NS_DOM_KEYNAME_NUMLOCK "NumLock"
934 #define NS_DOM_KEYNAME_SCROLLLOCK "ScrollLock"
935 #define NS_DOM_KEYNAME_SHIFT "Shift"
936 #define NS_DOM_KEYNAME_SYMBOLLOCK "SymbolLock"
937 #define NS_DOM_KEYNAME_OS "OS"
939 /******************************************************************************
940 * mozilla::Modifiers
941 ******************************************************************************/
943 typedef uint16_t Modifiers;
945 /******************************************************************************
946 * mozilla::WidgetInputEvent
947 ******************************************************************************/
949 class WidgetInputEvent : public WidgetGUIEvent
951 protected:
952 WidgetInputEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
953 EventClassID aEventClassID)
954 : WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
955 , modifiers(0)
959 WidgetInputEvent()
963 public:
964 virtual WidgetInputEvent* AsInputEvent() MOZ_OVERRIDE { return this; }
966 WidgetInputEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget)
967 : WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eInputEventClass)
968 , modifiers(0)
972 virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
974 MOZ_ASSERT(mClass == eInputEventClass,
975 "Duplicate() must be overridden by sub class");
976 // Not copying widget, it is a weak reference.
977 WidgetInputEvent* result = new WidgetInputEvent(false, message, nullptr);
978 result->AssignInputEventData(*this, true);
979 result->mFlags = mFlags;
980 return result;
985 * Returns a modifier of "Accel" virtual modifier which is used for shortcut
986 * key.
988 static Modifier AccelModifier();
990 // true indicates the accel key on the environment is down
991 bool IsAccel() const
993 return ((modifiers & AccelModifier()) != 0);
996 // true indicates the shift key is down
997 bool IsShift() const
999 return ((modifiers & MODIFIER_SHIFT) != 0);
1001 // true indicates the control key is down
1002 bool IsControl() const
1004 return ((modifiers & MODIFIER_CONTROL) != 0);
1006 // true indicates the alt key is down
1007 bool IsAlt() const
1009 return ((modifiers & MODIFIER_ALT) != 0);
1011 // true indicates the meta key is down (or, on Mac, the Command key)
1012 bool IsMeta() const
1014 return ((modifiers & MODIFIER_META) != 0);
1016 // true indicates the win key is down on Windows. Or the Super or Hyper key
1017 // is down on Linux.
1018 bool IsOS() const
1020 return ((modifiers & MODIFIER_OS) != 0);
1022 // true indicates the alt graph key is down
1023 // NOTE: on Mac, the option key press causes both IsAlt() and IsAltGrpah()
1024 // return true.
1025 bool IsAltGraph() const
1027 return ((modifiers & MODIFIER_ALTGRAPH) != 0);
1029 // true indeicates the CapLock LED is turn on.
1030 bool IsCapsLocked() const
1032 return ((modifiers & MODIFIER_CAPSLOCK) != 0);
1034 // true indeicates the NumLock LED is turn on.
1035 bool IsNumLocked() const
1037 return ((modifiers & MODIFIER_NUMLOCK) != 0);
1039 // true indeicates the ScrollLock LED is turn on.
1040 bool IsScrollLocked() const
1042 return ((modifiers & MODIFIER_SCROLLLOCK) != 0);
1045 // true indeicates the Fn key is down, but this is not supported by native
1046 // key event on any platform.
1047 bool IsFn() const
1049 return ((modifiers & MODIFIER_FN) != 0);
1051 // true indeicates the ScrollLock LED is turn on.
1052 bool IsSymbolLocked() const
1054 return ((modifiers & MODIFIER_SYMBOLLOCK) != 0);
1057 void InitBasicModifiers(bool aCtrlKey,
1058 bool aAltKey,
1059 bool aShiftKey,
1060 bool aMetaKey)
1062 modifiers = 0;
1063 if (aCtrlKey) {
1064 modifiers |= MODIFIER_CONTROL;
1066 if (aAltKey) {
1067 modifiers |= MODIFIER_ALT;
1069 if (aShiftKey) {
1070 modifiers |= MODIFIER_SHIFT;
1072 if (aMetaKey) {
1073 modifiers |= MODIFIER_META;
1077 Modifiers modifiers;
1079 void AssignInputEventData(const WidgetInputEvent& aEvent, bool aCopyTargets)
1081 AssignGUIEventData(aEvent, aCopyTargets);
1083 modifiers = aEvent.modifiers;
1087 /******************************************************************************
1088 * mozilla::InternalUIEvent
1090 * XXX Why this inherits WidgetGUIEvent rather than WidgetEvent?
1091 ******************************************************************************/
1093 class InternalUIEvent : public WidgetGUIEvent
1095 protected:
1096 InternalUIEvent()
1097 : detail(0)
1101 InternalUIEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
1102 EventClassID aEventClassID)
1103 : WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
1104 , detail(0)
1108 InternalUIEvent(bool aIsTrusted, uint32_t aMessage,
1109 EventClassID aEventClassID)
1110 : WidgetGUIEvent(aIsTrusted, aMessage, nullptr, aEventClassID)
1111 , detail(0)
1115 public:
1116 virtual InternalUIEvent* AsUIEvent() MOZ_OVERRIDE { return this; }
1118 InternalUIEvent(bool aIsTrusted, uint32_t aMessage)
1119 : WidgetGUIEvent(aIsTrusted, aMessage, nullptr, eUIEventClass)
1120 , detail(0)
1124 virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
1126 MOZ_ASSERT(mClass == eUIEventClass,
1127 "Duplicate() must be overridden by sub class");
1128 InternalUIEvent* result = new InternalUIEvent(false, message);
1129 result->AssignUIEventData(*this, true);
1130 result->mFlags = mFlags;
1131 return result;
1134 int32_t detail;
1136 void AssignUIEventData(const InternalUIEvent& aEvent, bool aCopyTargets)
1138 AssignGUIEventData(aEvent, aCopyTargets);
1140 detail = aEvent.detail;
1144 } // namespace mozilla
1146 #endif // mozilla_BasicEvents_h__