Revert accidental checkin to NSS.
[wine-gecko.git] / widget / public / nsGUIEvent.h
blob32e5cda81979d8c3e58c6ffbc7212f6f4c6f503e
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
13 * License.
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.
22 * Contributor(s):
23 * Makoto Kato <m_kato@ga2.so-net.ne.jp>
24 * Dean Tessman <dean_tessman@hotmail.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #ifndef nsGUIEvent_h__
41 #define nsGUIEvent_h__
43 #include "nsPoint.h"
44 #include "nsRect.h"
45 #include "nsEvent.h"
46 #include "nsStringGlue.h"
48 // nsIDOMEvent contains a long enum which includes a member called ERROR,
49 // which conflicts with something that Windows defines somewhere.
50 // So, undefine it:
51 #ifdef WIN32
52 #undef ERROR
53 #endif
54 #include "nsCOMPtr.h"
55 #include "nsIAtom.h"
56 #include "nsIDOMKeyEvent.h"
57 #include "nsWeakPtr.h"
58 #include "nsIWidget.h"
59 #include "nsTArray.h"
60 #include "nsTraceRefcnt.h"
62 class nsIRenderingContext;
63 class nsIRegion;
64 class nsIMenuItem;
65 class nsIAccessible;
66 class nsIContent;
67 class nsIURI;
68 class nsIDOMEvent;
69 class nsHashKey;
71 /**
72 * Event Struct Types
74 #define NS_EVENT 1
75 #define NS_GUI_EVENT 2
76 #define NS_SIZE_EVENT 3
77 #define NS_SIZEMODE_EVENT 4
78 #define NS_ZLEVEL_EVENT 5
79 #define NS_PAINT_EVENT 6
80 #define NS_SCROLLBAR_EVENT 7
81 #define NS_INPUT_EVENT 8
82 #define NS_KEY_EVENT 9
83 #define NS_MOUSE_EVENT 10
84 #define NS_MENU_EVENT 11
85 #define NS_SCRIPT_ERROR_EVENT 12
86 #define NS_TEXT_EVENT 13
87 #define NS_COMPOSITION_EVENT 14
88 #define NS_RECONVERSION_EVENT 15
89 #define NS_MOUSE_SCROLL_EVENT 16
90 #define NS_SCROLLPORT_EVENT 18
91 #define NS_MUTATION_EVENT 19 // |nsMutationEvent| in content
92 #define NS_ACCESSIBLE_EVENT 20
93 #define NS_FORM_EVENT 21
94 #define NS_FOCUS_EVENT 22
95 #define NS_POPUP_EVENT 23
96 #define NS_COMMAND_EVENT 24
97 #define NS_POPUPBLOCKED_EVENT 25
98 #define NS_BEFORE_PAGE_UNLOAD_EVENT 26
99 #define NS_UI_EVENT 27
100 #define NS_QUERYCARETRECT_EVENT 28
101 #define NS_PAGETRANSITION_EVENT 29
102 #ifdef MOZ_SVG
103 #define NS_SVG_EVENT 30
104 #define NS_SVGZOOM_EVENT 31
105 #endif // MOZ_SVG
106 #define NS_XUL_COMMAND_EVENT 32
107 #define NS_QUERY_CONTENT_EVENT 33
109 // These flags are sort of a mess. They're sort of shared between event
110 // listener flags and event flags, but only some of them. You've been
111 // warned!
112 #define NS_EVENT_FLAG_NONE 0x0000
113 #define NS_EVENT_FLAG_TRUSTED 0x0001
114 #define NS_EVENT_FLAG_BUBBLE 0x0002
115 #define NS_EVENT_FLAG_CAPTURE 0x0004
116 #define NS_EVENT_FLAG_STOP_DISPATCH 0x0008
117 #define NS_EVENT_FLAG_NO_DEFAULT 0x0010
118 #define NS_EVENT_FLAG_CANT_CANCEL 0x0020
119 #define NS_EVENT_FLAG_CANT_BUBBLE 0x0040
120 #define NS_PRIV_EVENT_FLAG_SCRIPT 0x0080
121 #define NS_EVENT_FLAG_NO_CONTENT_DISPATCH 0x0100
122 #define NS_EVENT_FLAG_SYSTEM_EVENT 0x0200
123 // Event has been dispatched at least once
124 #define NS_EVENT_DISPATCHED 0x0400
125 #define NS_EVENT_FLAG_DISPATCHING 0x0800
127 #define NS_PRIV_EVENT_UNTRUSTED_PERMITTED 0x8000
129 #define NS_EVENT_CAPTURE_MASK (~(NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
130 #define NS_EVENT_BUBBLE_MASK (~(NS_EVENT_FLAG_CAPTURE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
132 #define NS_EVENT_TYPE_NULL 0
135 * GUI MESSAGES
137 //@{
138 #define NS_EVENT_NULL 0
141 #define NS_WINDOW_START 100
143 // Widget is being created
144 #define NS_CREATE (NS_WINDOW_START)
145 // Widget may be destroyed
146 #define NS_XUL_CLOSE (NS_WINDOW_START + 1)
147 // Widget is being destroyed
148 #define NS_DESTROY (NS_WINDOW_START + 2)
149 // Widget was resized
150 #define NS_SIZE (NS_WINDOW_START + 3)
151 // Widget size mode was changed
152 #define NS_SIZEMODE (NS_WINDOW_START + 4)
153 // Widget gained focus
154 #define NS_GOTFOCUS (NS_WINDOW_START + 5)
155 // Widget lost focus
156 #define NS_LOSTFOCUS (NS_WINDOW_START + 6)
157 // Widget got activated
158 #define NS_ACTIVATE (NS_WINDOW_START + 7)
159 // Widget got deactivated
160 #define NS_DEACTIVATE (NS_WINDOW_START + 8)
161 // top-level window z-level change request
162 #define NS_SETZLEVEL (NS_WINDOW_START + 9)
163 // Widget needs to be repainted
164 #define NS_PAINT (NS_WINDOW_START + 30)
165 // Key is pressed within a window
166 #define NS_KEY_PRESS (NS_WINDOW_START + 31)
167 // Key is released within a window
168 #define NS_KEY_UP (NS_WINDOW_START + 32)
169 // Key is pressed within a window
170 #define NS_KEY_DOWN (NS_WINDOW_START + 33)
171 // Window has been moved to a new location.
172 // The events point contains the x, y location in screen coordinates
173 #define NS_MOVE (NS_WINDOW_START + 34)
175 // Tab control's selected tab has changed
176 #define NS_TABCHANGE (NS_WINDOW_START + 35)
178 #define NS_OS_TOOLBAR (NS_WINDOW_START + 36)
180 // Menu item selected
181 #define NS_MENU_SELECTED (NS_WINDOW_START + 38)
183 // Form control changed: currently == combo box selection changed
184 // but could be expanded to mean textbox, checkbox changed, etc.
185 // This is a GUI specific event that does not necessarily correspond
186 // directly to a mouse click or a key press.
187 #define NS_CONTROL_CHANGE (NS_WINDOW_START + 39)
189 // Indicates the display has changed depth
190 #define NS_DISPLAYCHANGED (NS_WINDOW_START + 40)
192 // Indicates a theme change has occurred
193 #define NS_THEMECHANGED (NS_WINDOW_START + 41)
195 // Indicates a System color has changed. It is the platform
196 // toolkits responsibility to invalidate the window to
197 // ensure that it is drawn using the current system colors.
198 #define NS_SYSCOLORCHANGED (NS_WINDOW_START + 42)
200 #define NS_RESIZE_EVENT (NS_WINDOW_START + 60)
201 #define NS_SCROLL_EVENT (NS_WINDOW_START + 61)
203 #define NS_PLUGIN_ACTIVATE (NS_WINDOW_START + 62)
205 #define NS_OFFLINE (NS_WINDOW_START + 63)
206 #define NS_ONLINE (NS_WINDOW_START + 64)
208 #define NS_MOUSE_MESSAGE_START 300
209 #define NS_MOUSE_MOVE (NS_MOUSE_MESSAGE_START)
210 #define NS_MOUSE_BUTTON_UP (NS_MOUSE_MESSAGE_START + 1)
211 #define NS_MOUSE_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 2)
212 #define NS_MOUSE_ENTER (NS_MOUSE_MESSAGE_START + 22)
213 #define NS_MOUSE_EXIT (NS_MOUSE_MESSAGE_START + 23)
214 #define NS_MOUSE_DOUBLECLICK (NS_MOUSE_MESSAGE_START + 24)
215 #define NS_MOUSE_CLICK (NS_MOUSE_MESSAGE_START + 27)
216 #define NS_MOUSE_ACTIVATE (NS_MOUSE_MESSAGE_START + 30)
217 #define NS_MOUSE_ENTER_SYNTH (NS_MOUSE_MESSAGE_START + 31)
218 #define NS_MOUSE_EXIT_SYNTH (NS_MOUSE_MESSAGE_START + 32)
220 #define NS_CONTEXTMENU_MESSAGE_START 500
221 #define NS_CONTEXTMENU (NS_CONTEXTMENU_MESSAGE_START)
223 #define NS_SCROLLBAR_MESSAGE_START 1000
224 #define NS_SCROLLBAR_POS (NS_SCROLLBAR_MESSAGE_START)
225 #define NS_SCROLLBAR_PAGE_NEXT (NS_SCROLLBAR_MESSAGE_START + 1)
226 #define NS_SCROLLBAR_PAGE_PREV (NS_SCROLLBAR_MESSAGE_START + 2)
227 #define NS_SCROLLBAR_LINE_NEXT (NS_SCROLLBAR_MESSAGE_START + 3)
228 #define NS_SCROLLBAR_LINE_PREV (NS_SCROLLBAR_MESSAGE_START + 4)
230 #define NS_STREAM_EVENT_START 1100
231 #define NS_LOAD (NS_STREAM_EVENT_START)
232 #define NS_PAGE_UNLOAD (NS_STREAM_EVENT_START + 1)
233 #define NS_IMAGE_ABORT (NS_STREAM_EVENT_START + 3)
234 #define NS_LOAD_ERROR (NS_STREAM_EVENT_START + 4)
235 #define NS_BEFORE_PAGE_UNLOAD (NS_STREAM_EVENT_START + 6)
236 #define NS_PAGE_RESTORE (NS_STREAM_EVENT_START + 7)
238 #define NS_FORM_EVENT_START 1200
239 #define NS_FORM_SUBMIT (NS_FORM_EVENT_START)
240 #define NS_FORM_RESET (NS_FORM_EVENT_START + 1)
241 #define NS_FORM_CHANGE (NS_FORM_EVENT_START + 2)
242 #define NS_FORM_SELECTED (NS_FORM_EVENT_START + 3)
243 #define NS_FORM_INPUT (NS_FORM_EVENT_START + 4)
245 //Need separate focus/blur notifications for non-native widgets
246 #define NS_FOCUS_EVENT_START 1300
247 #define NS_FOCUS_CONTENT (NS_FOCUS_EVENT_START)
248 #define NS_BLUR_CONTENT (NS_FOCUS_EVENT_START + 1)
251 #define NS_DRAGDROP_EVENT_START 1400
252 #define NS_DRAGDROP_ENTER (NS_DRAGDROP_EVENT_START)
253 #define NS_DRAGDROP_OVER (NS_DRAGDROP_EVENT_START + 1)
254 #define NS_DRAGDROP_EXIT (NS_DRAGDROP_EVENT_START + 2)
255 #define NS_DRAGDROP_DROP (NS_DRAGDROP_EVENT_START + 3)
256 #define NS_DRAGDROP_GESTURE (NS_DRAGDROP_EVENT_START + 4)
257 #define NS_DRAGDROP_DRAG (NS_DRAGDROP_EVENT_START + 5)
258 #define NS_DRAGDROP_END (NS_DRAGDROP_EVENT_START + 6)
259 #define NS_DRAGDROP_OVER_SYNTH (NS_DRAGDROP_EVENT_START + 1)
260 #define NS_DRAGDROP_EXIT_SYNTH (NS_DRAGDROP_EVENT_START + 2)
262 // Events for popups
263 #define NS_XUL_EVENT_START 1500
264 #define NS_XUL_POPUP_SHOWING (NS_XUL_EVENT_START)
265 #define NS_XUL_POPUP_SHOWN (NS_XUL_EVENT_START+1)
266 #define NS_XUL_POPUP_HIDING (NS_XUL_EVENT_START+2)
267 #define NS_XUL_POPUP_HIDDEN (NS_XUL_EVENT_START+3)
268 // NS_XUL_COMMAND used to be here (NS_XUL_EVENT_START+4)
269 #define NS_XUL_BROADCAST (NS_XUL_EVENT_START+5)
270 #define NS_XUL_COMMAND_UPDATE (NS_XUL_EVENT_START+6)
271 //@}
273 // Scroll events
274 #define NS_MOUSE_SCROLL_START 1600
275 #define NS_MOUSE_SCROLL (NS_MOUSE_SCROLL_START)
277 #define NS_SCROLLPORT_START 1700
278 #define NS_SCROLLPORT_UNDERFLOW (NS_SCROLLPORT_START)
279 #define NS_SCROLLPORT_OVERFLOW (NS_SCROLLPORT_START+1)
280 #define NS_SCROLLPORT_OVERFLOWCHANGED (NS_SCROLLPORT_START+2)
282 // Mutation events defined elsewhere starting at 1800
284 // accessible events
285 #define NS_ACCESSIBLE_START 1900
286 #define NS_GETACCESSIBLE (NS_ACCESSIBLE_START)
288 #define NS_USER_DEFINED_EVENT 2000
290 // composition events
291 #define NS_COMPOSITION_EVENT_START 2200
292 #define NS_COMPOSITION_START (NS_COMPOSITION_EVENT_START)
293 #define NS_COMPOSITION_END (NS_COMPOSITION_EVENT_START + 1)
294 #define NS_COMPOSITION_QUERY (NS_COMPOSITION_EVENT_START + 2)
296 // reconversion events
297 #define NS_RECONVERSION_START 2300
298 #define NS_RECONVERSION_QUERY (NS_RECONVERSION_START)
300 // text events
301 #define NS_TEXT_START 2400
302 #define NS_TEXT_TEXT (NS_TEXT_START)
304 // UI events
305 #define NS_UI_EVENT_START 2500
306 // this is not to be confused with NS_ACTIVATE!
307 #define NS_UI_ACTIVATE (NS_UI_EVENT_START)
308 #define NS_UI_FOCUSIN (NS_UI_EVENT_START + 1)
309 #define NS_UI_FOCUSOUT (NS_UI_EVENT_START + 2)
311 // query caret rect events
312 #define NS_QUERYCARETRECT_START 2600
313 #define NS_QUERYCARETRECT (NS_QUERYCARETRECT_START)
315 // pagetransition events
316 #define NS_PAGETRANSITION_START 2700
317 #define NS_PAGE_SHOW (NS_PAGETRANSITION_START + 1)
318 #define NS_PAGE_HIDE (NS_PAGETRANSITION_START + 2)
320 #ifdef MOZ_SVG
321 // SVG events
322 #define NS_SVG_EVENT_START 2800
323 #define NS_SVG_LOAD (NS_SVG_EVENT_START)
324 #define NS_SVG_UNLOAD (NS_SVG_EVENT_START + 1)
325 #define NS_SVG_ABORT (NS_SVG_EVENT_START + 2)
326 #define NS_SVG_ERROR (NS_SVG_EVENT_START + 3)
327 #define NS_SVG_RESIZE (NS_SVG_EVENT_START + 4)
328 #define NS_SVG_SCROLL (NS_SVG_EVENT_START + 5)
330 // SVG Zoom events
331 #define NS_SVGZOOM_EVENT_START 2900
332 #define NS_SVG_ZOOM (NS_SVGZOOM_EVENT_START)
333 #endif // MOZ_SVG
335 // XUL command events
336 #define NS_XULCOMMAND_EVENT_START 3000
337 #define NS_XUL_COMMAND (NS_XULCOMMAND_EVENT_START)
339 // Cut, copy, paste events
340 #define NS_CUTCOPYPASTE_EVENT_START 3100
341 #define NS_COPY (NS_CUTCOPYPASTE_EVENT_START)
342 #define NS_CUT (NS_CUTCOPYPASTE_EVENT_START + 1)
343 #define NS_PASTE (NS_CUTCOPYPASTE_EVENT_START + 2)
345 // Query the content information
346 #define NS_QUERY_CONTENT_EVENT_START 3200
347 // Query for the selected text information, it return the selection offset,
348 // selection length and selected text.
349 #define NS_QUERY_SELECTED_TEXT (NS_QUERY_CONTENT_EVENT_START)
350 // Query for the text content of specified range, it returns actual lengh (if
351 // the specified range is too long) and the text of the specified range.
352 #define NS_QUERY_TEXT_CONTENT (NS_QUERY_CONTENT_EVENT_START + 1)
353 // Query for the character rect of nth character. If there is no character at
354 // the offset, the query will be failed. The offset of the result is relative
355 // position from the top level widget.
356 #define NS_QUERY_CHARACTER_RECT (NS_QUERY_CONTENT_EVENT_START + 2)
357 // Query for the caret rect of nth insertion point. The offset of the result is
358 // relative position from the top level widget.
359 #define NS_QUERY_CARET_RECT (NS_QUERY_CONTENT_EVENT_START + 3)
362 * Return status for event processors, nsEventStatus, is defined in
363 * nsEvent.h.
367 * sizemode is an adjunct to widget size
369 enum nsSizeMode {
370 nsSizeMode_Normal = 0,
371 nsSizeMode_Minimized,
372 nsSizeMode_Maximized
376 * different types of (top-level) window z-level positioning
378 enum nsWindowZ {
379 nsWindowZTop = 0, // on top
380 nsWindowZBottom, // on bottom
381 nsWindowZRelative // just below some specified widget
385 * General event
388 class nsEvent
390 protected:
391 nsEvent(PRBool isTrusted, PRUint32 msg, PRUint8 structType)
392 : eventStructType(structType),
393 message(msg),
394 refPoint(0, 0),
395 time(0),
396 flags(isTrusted ? NS_EVENT_FLAG_TRUSTED : NS_EVENT_FLAG_NONE),
397 userType(0)
399 MOZ_COUNT_CTOR(nsEvent);
402 public:
403 nsEvent(PRBool isTrusted, PRUint32 msg)
404 : eventStructType(NS_EVENT),
405 message(msg),
406 refPoint(0, 0),
407 time(0),
408 flags(isTrusted ? NS_EVENT_FLAG_TRUSTED : NS_EVENT_FLAG_NONE),
409 userType(0)
411 MOZ_COUNT_CTOR(nsEvent);
414 ~nsEvent()
416 MOZ_COUNT_DTOR(nsEvent);
419 // See event struct types
420 PRUint8 eventStructType;
421 // See GUI MESSAGES,
422 PRUint32 message;
423 // In widget relative coordinates, not modified by layout code.
424 nsPoint refPoint;
425 // Elapsed time, in milliseconds, from a platform-specific zero time
426 // to the time the message was created
427 PRUint32 time;
428 // Flags to hold event flow stage and capture/bubble cancellation
429 // status. This is used also to indicate whether the event is trusted.
430 PRUint32 flags;
431 // Additional type info for user defined events
432 nsCOMPtr<nsIAtom> userType;
433 // Event targets, needed by DOM Events
434 // Using nsISupports, not nsIDOMEventTarget because in some cases
435 // nsIDOMEventTarget is implemented as a tearoff.
436 nsCOMPtr<nsISupports> target;
437 nsCOMPtr<nsISupports> currentTarget;
438 nsCOMPtr<nsISupports> originalTarget;
442 * General graphic user interface event
445 class nsGUIEvent : public nsEvent
447 protected:
448 nsGUIEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w, PRUint8 structType)
449 : nsEvent(isTrusted, msg, structType),
450 widget(w), nativeMsg(nsnull)
454 public:
455 nsGUIEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
456 : nsEvent(isTrusted, msg, NS_GUI_EVENT),
457 widget(w), nativeMsg(nsnull)
461 /// Originator of the event
462 nsCOMPtr<nsIWidget> widget;
463 /// Internal platform specific message.
464 void* nativeMsg;
468 * Script error event
471 class nsScriptErrorEvent : public nsEvent
473 public:
474 nsScriptErrorEvent(PRBool isTrusted, PRUint32 msg)
475 : nsEvent(isTrusted, msg, NS_SCRIPT_ERROR_EVENT),
476 lineNr(0), errorMsg(nsnull), fileName(nsnull)
480 PRInt32 lineNr;
481 const PRUnichar* errorMsg;
482 const PRUnichar* fileName;
485 class nsBeforePageUnloadEvent : public nsEvent
487 public:
488 nsBeforePageUnloadEvent(PRBool isTrusted, PRUint32 msg)
489 : nsEvent(isTrusted, msg, NS_BEFORE_PAGE_UNLOAD_EVENT)
493 nsString text;
497 * Window resize event
500 class nsSizeEvent : public nsGUIEvent
502 public:
503 nsSizeEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
504 : nsGUIEvent(isTrusted, msg, w, NS_SIZE_EVENT),
505 windowSize(nsnull), mWinWidth(0), mWinHeight(0)
509 /// x,y width, height in pixels (client area)
510 nsRect *windowSize;
511 /// width of entire window (in pixels)
512 PRInt32 mWinWidth;
513 /// height of entire window (in pixels)
514 PRInt32 mWinHeight;
518 * Window size mode event
521 class nsSizeModeEvent : public nsGUIEvent
523 public:
524 nsSizeModeEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
525 : nsGUIEvent(isTrusted, msg, w, NS_SIZEMODE_EVENT),
526 mSizeMode(nsSizeMode_Normal)
530 nsSizeMode mSizeMode;
534 * Window z-level event
537 class nsZLevelEvent : public nsGUIEvent
539 public:
540 nsZLevelEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
541 : nsGUIEvent(isTrusted, msg, w, NS_ZLEVEL_EVENT),
542 mPlacement(nsWindowZTop), mReqBelow(nsnull), mActualBelow(nsnull),
543 mImmediate(PR_FALSE), mAdjusted(PR_FALSE)
547 nsWindowZ mPlacement;
548 nsIWidget *mReqBelow, // widget we request being below, if any
549 *mActualBelow; // widget to be below, returned by handler
550 PRBool mImmediate, // handler should make changes immediately
551 mAdjusted; // handler changed placement
555 * Window repaint event
558 class nsPaintEvent : public nsGUIEvent
560 public:
561 nsPaintEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
562 : nsGUIEvent(isTrusted, msg, w, NS_PAINT_EVENT),
563 renderingContext(nsnull), region(nsnull), rect(nsnull)
567 /// Context to paint in.
568 nsIRenderingContext *renderingContext;
569 /// area to paint (should be used instead of rect)
570 nsIRegion *region;
571 /// x,y, width, height in pixels of area to paint
572 nsRect *rect;
576 * Scrollbar event
579 class nsScrollbarEvent : public nsGUIEvent
581 public:
582 nsScrollbarEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
583 : nsGUIEvent(isTrusted, msg, w, NS_SCROLLBAR_EVENT),
584 position(0)
588 /// ranges between scrollbar 0 and (maxRange - thumbSize). See nsIScrollbar
589 PRUint32 position;
592 class nsScrollPortEvent : public nsGUIEvent
594 public:
595 enum orientType {
596 vertical = 0,
597 horizontal = 1,
598 both = 2
601 nsScrollPortEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
602 : nsGUIEvent(isTrusted, msg, w, NS_SCROLLPORT_EVENT),
603 orient(vertical)
607 orientType orient;
610 class nsInputEvent : public nsGUIEvent
612 protected:
613 nsInputEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w,
614 PRUint8 structType)
615 : nsGUIEvent(isTrusted, msg, w, structType),
616 isShift(PR_FALSE), isControl(PR_FALSE), isAlt(PR_FALSE), isMeta(PR_FALSE)
620 public:
621 nsInputEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
622 : nsGUIEvent(isTrusted, msg, w, NS_INPUT_EVENT),
623 isShift(PR_FALSE), isControl(PR_FALSE), isAlt(PR_FALSE), isMeta(PR_FALSE)
627 /// PR_TRUE indicates the shift key is down
628 PRBool isShift;
629 /// PR_TRUE indicates the control key is down
630 PRBool isControl;
631 /// PR_TRUE indicates the alt key is down
632 PRBool isAlt;
633 /// PR_TRUE indicates the meta key is down (or, on Mac, the Command key)
634 PRBool isMeta;
638 * Mouse event
641 class nsMouseEvent_base : public nsInputEvent
643 public:
644 nsMouseEvent_base(PRBool isTrusted, PRUint32 msg, nsIWidget *w, PRUint8 type)
645 : nsInputEvent(isTrusted, msg, w, type), button(0) {}
647 /// The possible related target
648 nsCOMPtr<nsISupports> relatedTarget;
650 PRInt16 button;
653 class nsMouseEvent : public nsMouseEvent_base
655 public:
656 enum buttonType { eLeftButton = 0, eMiddleButton = 1, eRightButton = 2 };
657 enum reasonType { eReal, eSynthesized };
658 enum contextType { eNormal, eContextMenuKey };
659 enum exitType { eChild, eTopLevel };
661 nsMouseEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w,
662 reasonType aReason, contextType aContext = eNormal)
663 : nsMouseEvent_base(isTrusted, msg, w, NS_MOUSE_EVENT),
664 acceptActivation(PR_FALSE), reason(aReason), context(aContext),
665 exit(eChild), clickCount(0)
667 if (msg == NS_MOUSE_MOVE) {
668 flags |= NS_EVENT_FLAG_CANT_CANCEL;
669 } else if (msg == NS_CONTEXTMENU) {
670 button = (context == eNormal) ? eRightButton : eLeftButton;
673 #ifdef NS_DEBUG
674 ~nsMouseEvent() {
675 NS_WARN_IF_FALSE(message != NS_CONTEXTMENU ||
676 button ==
677 ((context == eNormal) ? eRightButton : eLeftButton),
678 "Wrong button set to NS_CONTEXTMENU event?");
680 #endif
682 /// Special return code for MOUSE_ACTIVATE to signal
683 /// if the target accepts activation (1), or denies it (0)
684 PRPackedBool acceptActivation;
685 reasonType reason : 4;
686 contextType context : 4;
687 exitType exit;
689 /// The number of mouse clicks
690 PRUint32 clickCount;
694 * Accessible event
697 class nsAccessibleEvent : public nsInputEvent
699 public:
700 nsAccessibleEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
701 : nsInputEvent(isTrusted, msg, w, NS_ACCESSIBLE_EVENT),
702 accessible(nsnull)
706 nsIAccessible* accessible;
710 * Keyboard event
713 struct nsAlternativeCharCode {
714 nsAlternativeCharCode(PRUint32 aUnshiftedCharCode,
715 PRUint32 aShiftedCharCode) :
716 mUnshiftedCharCode(aUnshiftedCharCode), mShiftedCharCode(aShiftedCharCode)
719 PRUint32 mUnshiftedCharCode;
720 PRUint32 mShiftedCharCode;
723 class nsKeyEvent : public nsInputEvent
725 public:
726 nsKeyEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
727 : nsInputEvent(isTrusted, msg, w, NS_KEY_EVENT),
728 keyCode(0), charCode(0), isChar(0)
732 /// see NS_VK codes
733 PRUint32 keyCode;
734 /// OS translated Unicode char
735 PRUint32 charCode;
736 // OS translated Unicode chars which are used for accesskey and accelkey
737 // handling. The handlers will try from first character to last character.
738 nsTArray<nsAlternativeCharCode> alternativeCharCodes;
739 // indicates whether the event signifies a printable character
740 PRBool isChar;
744 * IME Related Events
746 struct nsTextRange
748 nsTextRange()
749 : mStartOffset(0), mEndOffset(0), mRangeType(0)
753 PRUint32 mStartOffset;
754 PRUint32 mEndOffset;
755 PRUint32 mRangeType;
758 typedef nsTextRange* nsTextRangeArray;
760 struct nsTextEventReply
762 nsTextEventReply()
763 : mCursorIsCollapsed(PR_FALSE)
767 nsRect mCursorPosition;
768 PRBool mCursorIsCollapsed;
771 typedef struct nsTextEventReply nsTextEventReply;
773 class nsTextEvent : public nsInputEvent
775 public:
776 nsTextEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
777 : nsInputEvent(isTrusted, msg, w, NS_TEXT_EVENT),
778 theText(nsnull), rangeCount(0), rangeArray(nsnull), isChar(PR_FALSE)
782 const PRUnichar* theText;
783 nsTextEventReply theReply;
784 PRUint32 rangeCount;
785 nsTextRangeArray rangeArray;
786 PRBool isChar;
789 class nsCompositionEvent : public nsInputEvent
791 public:
792 nsCompositionEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
793 : nsInputEvent(isTrusted, msg, w, NS_COMPOSITION_EVENT)
797 nsTextEventReply theReply;
800 class nsMouseScrollEvent : public nsMouseEvent_base
802 public:
803 enum nsMouseScrollFlags {
804 kIsFullPage = 1 << 0,
805 kIsVertical = 1 << 1,
806 kIsHorizontal = 1 << 2,
807 kIsPixels = 1 << 3
810 nsMouseScrollEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
811 : nsMouseEvent_base(isTrusted, msg, w, NS_MOUSE_SCROLL_EVENT),
812 scrollFlags(0), delta(0)
816 PRInt32 scrollFlags;
817 PRInt32 delta;
820 struct nsReconversionEventReply {
821 nsReconversionEventReply()
822 : mReconversionString(nsnull)
826 PRUnichar *mReconversionString;
829 class nsReconversionEvent : public nsInputEvent
831 public:
832 nsReconversionEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
833 : nsInputEvent(isTrusted, msg, w, NS_RECONVERSION_EVENT)
837 nsReconversionEventReply theReply;
840 struct nsQueryCaretRectEventReply
842 nsQueryCaretRectEventReply()
843 : mRectIsValid(PR_FALSE)
847 PRBool mRectIsValid;
848 nsRect mCaretRect;
851 class nsQueryCaretRectEvent : public nsInputEvent
853 public:
854 nsQueryCaretRectEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
855 : nsInputEvent(isTrusted, msg, w, NS_QUERYCARETRECT_EVENT)
859 nsQueryCaretRectEventReply theReply;
862 class nsQueryContentEvent : public nsGUIEvent
864 public:
865 nsQueryContentEvent(PRBool aIsTrusted, PRUint32 aMsg, nsIWidget *aWidget) :
866 nsGUIEvent(aIsTrusted, aMsg, aWidget, NS_QUERY_CONTENT_EVENT),
867 mSucceeded(PR_FALSE)
871 void InitForQueryTextContent(PRUint32 aOffset, PRUint32 aLength)
873 NS_ASSERTION(message == NS_QUERY_TEXT_CONTENT,
874 "wrong initializer is called");
875 mInput.mOffset = aOffset;
876 mInput.mLength = aLength;
879 void InitForQueryCharacterRect(PRUint32 aOffset)
881 NS_ASSERTION(message == NS_QUERY_CHARACTER_RECT,
882 "wrong initializer is called");
883 mInput.mOffset = aOffset;
886 void InitForQueryCaretRect(PRUint32 aOffset)
888 NS_ASSERTION(message == NS_QUERY_CARET_RECT,
889 "wrong initializer is called");
890 mInput.mOffset = aOffset;
893 PRBool mSucceeded;
894 struct {
895 PRUint32 mOffset;
896 PRUint32 mLength;
897 } mInput;
898 struct {
899 void* mContentsRoot;
900 PRUint32 mOffset;
901 nsString mString;
902 nsRect mRect; // Finally, the coordinates is system coordinates.
903 } mReply;
907 * MenuItem event
909 * When this event occurs the widget field in nsGUIEvent holds the "target"
910 * for the event
913 class nsMenuEvent : public nsGUIEvent
915 public:
916 nsMenuEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
917 : nsGUIEvent(isTrusted, msg, w, NS_MENU_EVENT),
918 mMenuItem(nsnull), mCommand(0)
922 nsIMenuItem * mMenuItem;
923 PRUint32 mCommand;
927 * Form event
929 * We hold the originating form control for form submit and reset events.
930 * originator is a weak pointer (does not hold a strong reference).
933 class nsFormEvent : public nsEvent
935 public:
936 nsFormEvent(PRBool isTrusted, PRUint32 msg)
937 : nsEvent(isTrusted, msg, NS_FORM_EVENT),
938 originator(nsnull)
942 nsIContent *originator;
946 * Focus event
948 class nsFocusEvent : public nsGUIEvent
950 public:
951 nsFocusEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
952 : nsGUIEvent(isTrusted, msg, w, NS_FOCUS_EVENT),
953 isMozWindowTakingFocus(PR_FALSE)
957 PRBool isMozWindowTakingFocus;
961 * Command event
963 * Custom commands for example from the operating system.
966 class nsCommandEvent : public nsGUIEvent
968 public:
969 nsCommandEvent(PRBool isTrusted, nsIAtom* aEventType,
970 nsIAtom* aCommand, nsIWidget* w)
971 : nsGUIEvent(isTrusted, NS_USER_DEFINED_EVENT, w, NS_COMMAND_EVENT)
973 userType = aEventType;
974 command = aCommand;
977 nsCOMPtr<nsIAtom> command;
981 * blocked popup window event
983 class nsPopupBlockedEvent : public nsEvent
985 public:
986 nsPopupBlockedEvent(PRBool isTrusted, PRUint32 msg)
987 : nsEvent(isTrusted, msg, NS_POPUPBLOCKED_EVENT),
988 mPopupWindowURI(nsnull)
992 nsWeakPtr mRequestingWindow;
993 nsIURI* mPopupWindowURI; // owning reference
994 nsString mPopupWindowFeatures;
995 nsString mPopupWindowName;
999 * DOM UIEvent
1001 class nsUIEvent : public nsEvent
1003 public:
1004 nsUIEvent(PRBool isTrusted, PRUint32 msg, PRInt32 d)
1005 : nsEvent(isTrusted, msg, NS_UI_EVENT),
1006 detail(d)
1010 PRInt32 detail;
1014 * PageTransition event
1016 class nsPageTransitionEvent : public nsEvent
1018 public:
1019 nsPageTransitionEvent(PRBool isTrusted, PRUint32 msg, PRBool p)
1020 : nsEvent(isTrusted, msg, NS_PAGETRANSITION_EVENT),
1021 persisted(p)
1025 PRBool persisted;
1029 * XUL command event
1031 class nsXULCommandEvent : public nsInputEvent
1033 public:
1034 nsXULCommandEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
1035 : nsInputEvent(isTrusted, msg, w, NS_XUL_COMMAND_EVENT)
1039 nsCOMPtr<nsIDOMEvent> sourceEvent;
1043 * Event status for D&D Event
1045 enum nsDragDropEventStatus {
1046 /// The event is a enter
1047 nsDragDropEventStatus_eDragEntered,
1048 /// The event is exit
1049 nsDragDropEventStatus_eDragExited,
1050 /// The event is drop
1051 nsDragDropEventStatus_eDrop
1055 #define NS_IS_MOUSE_EVENT(evnt) \
1056 (((evnt)->message == NS_MOUSE_BUTTON_DOWN) || \
1057 ((evnt)->message == NS_MOUSE_BUTTON_UP) || \
1058 ((evnt)->message == NS_MOUSE_CLICK) || \
1059 ((evnt)->message == NS_MOUSE_DOUBLECLICK) || \
1060 ((evnt)->message == NS_MOUSE_ENTER) || \
1061 ((evnt)->message == NS_MOUSE_EXIT) || \
1062 ((evnt)->message == NS_MOUSE_ACTIVATE) || \
1063 ((evnt)->message == NS_MOUSE_ENTER_SYNTH) || \
1064 ((evnt)->message == NS_MOUSE_EXIT_SYNTH) || \
1065 ((evnt)->message == NS_MOUSE_MOVE))
1067 #define NS_IS_MOUSE_LEFT_CLICK(evnt) \
1068 ((evnt)->eventStructType == NS_MOUSE_EVENT && \
1069 (evnt)->message == NS_MOUSE_CLICK && \
1070 static_cast<nsMouseEvent*>((evnt))->button == nsMouseEvent::eLeftButton)
1072 #define NS_IS_CONTEXT_MENU_KEY(evnt) \
1073 ((evnt)->eventStructType == NS_MOUSE_EVENT && \
1074 (evnt)->message == NS_CONTEXTMENU && \
1075 static_cast<nsMouseEvent*>((evnt))->context == nsMouseEvent::eContextMenuKey)
1077 #define NS_IS_DRAG_EVENT(evnt) \
1078 (((evnt)->message == NS_DRAGDROP_ENTER) || \
1079 ((evnt)->message == NS_DRAGDROP_OVER) || \
1080 ((evnt)->message == NS_DRAGDROP_EXIT) || \
1081 ((evnt)->message == NS_DRAGDROP_DROP) || \
1082 ((evnt)->message == NS_DRAGDROP_GESTURE) || \
1083 ((evnt)->message == NS_DRAGDROP_OVER_SYNTH) || \
1084 ((evnt)->message == NS_DRAGDROP_EXIT_SYNTH))
1086 #define NS_IS_KEY_EVENT(evnt) \
1087 (((evnt)->message == NS_KEY_DOWN) || \
1088 ((evnt)->message == NS_KEY_PRESS) || \
1089 ((evnt)->message == NS_KEY_UP))
1091 #define NS_IS_IME_EVENT(evnt) \
1092 (((evnt)->message == NS_TEXT_TEXT) || \
1093 ((evnt)->message == NS_COMPOSITION_START) || \
1094 ((evnt)->message == NS_COMPOSITION_END) || \
1095 ((evnt)->message == NS_RECONVERSION_QUERY) || \
1096 ((evnt)->message == NS_QUERYCARETRECT) || \
1097 ((evnt)->message == NS_COMPOSITION_QUERY))
1099 #define NS_IS_FOCUS_EVENT(evnt) \
1100 (((evnt)->message == NS_GOTFOCUS) || \
1101 ((evnt)->message == NS_LOSTFOCUS) || \
1102 ((evnt)->message == NS_ACTIVATE) || \
1103 ((evnt)->message == NS_DEACTIVATE) || \
1104 ((evnt)->message == NS_PLUGIN_ACTIVATE))
1106 #define NS_IS_QUERY_CONTENT_EVENT(evnt) \
1107 (((evnt)->message == NS_QUERY_SELECTED_TEXT) || \
1108 ((evnt)->message == NS_QUERY_TEXT_CONTENT) || \
1109 ((evnt)->message == NS_QUERY_CHARACTER_RECT) || \
1110 ((evnt)->message == NS_QUERY_CARET_RECT))
1112 #define NS_IS_TRUSTED_EVENT(event) \
1113 (((event)->flags & NS_EVENT_FLAG_TRUSTED) != 0)
1115 // Mark an event as being dispatching.
1116 #define NS_MARK_EVENT_DISPATCH_STARTED(event) \
1117 (event)->flags |= NS_EVENT_FLAG_DISPATCHING;
1119 #define NS_IS_EVENT_IN_DISPATCH(event) \
1120 (((event)->flags & NS_EVENT_FLAG_DISPATCHING) != 0)
1122 // Mark an event as being done dispatching.
1123 #define NS_MARK_EVENT_DISPATCH_DONE(event) \
1124 NS_ASSERTION(NS_IS_EVENT_IN_DISPATCH(event), \
1125 "Event never got marked for dispatch!"); \
1126 (event)->flags &= ~NS_EVENT_FLAG_DISPATCHING; \
1127 (event)->flags |= NS_EVENT_DISPATCHED;
1130 * Virtual key bindings for keyboard events.
1131 * These come from nsIDOMKeyEvent.h, which is generated from MouseKeyEvent.idl.
1132 * Really, it would be better if we phased out the NS_VK symbols altogether
1133 * in favor of the DOM ones, but at least this way they'll be in sync.
1136 #define NS_VK_CANCEL nsIDOMKeyEvent::DOM_VK_CANCEL
1137 #define NS_VK_HELP nsIDOMKeyEvent::DOM_VK_HELP
1138 #define NS_VK_BACK nsIDOMKeyEvent::DOM_VK_BACK_SPACE
1139 #define NS_VK_TAB nsIDOMKeyEvent::DOM_VK_TAB
1140 #define NS_VK_CLEAR nsIDOMKeyEvent::DOM_VK_CLEAR
1141 #define NS_VK_RETURN nsIDOMKeyEvent::DOM_VK_RETURN
1142 #define NS_VK_ENTER nsIDOMKeyEvent::DOM_VK_ENTER
1143 #define NS_VK_SHIFT nsIDOMKeyEvent::DOM_VK_SHIFT
1144 #define NS_VK_CONTROL nsIDOMKeyEvent::DOM_VK_CONTROL
1145 #define NS_VK_ALT nsIDOMKeyEvent::DOM_VK_ALT
1146 #define NS_VK_PAUSE nsIDOMKeyEvent::DOM_VK_PAUSE
1147 #define NS_VK_CAPS_LOCK nsIDOMKeyEvent::DOM_VK_CAPS_LOCK
1148 #define NS_VK_ESCAPE nsIDOMKeyEvent::DOM_VK_ESCAPE
1149 #define NS_VK_SPACE nsIDOMKeyEvent::DOM_VK_SPACE
1150 #define NS_VK_PAGE_UP nsIDOMKeyEvent::DOM_VK_PAGE_UP
1151 #define NS_VK_PAGE_DOWN nsIDOMKeyEvent::DOM_VK_PAGE_DOWN
1152 #define NS_VK_END nsIDOMKeyEvent::DOM_VK_END
1153 #define NS_VK_HOME nsIDOMKeyEvent::DOM_VK_HOME
1154 #define NS_VK_LEFT nsIDOMKeyEvent::DOM_VK_LEFT
1155 #define NS_VK_UP nsIDOMKeyEvent::DOM_VK_UP
1156 #define NS_VK_RIGHT nsIDOMKeyEvent::DOM_VK_RIGHT
1157 #define NS_VK_DOWN nsIDOMKeyEvent::DOM_VK_DOWN
1158 #define NS_VK_PRINTSCREEN nsIDOMKeyEvent::DOM_VK_PRINTSCREEN
1159 #define NS_VK_INSERT nsIDOMKeyEvent::DOM_VK_INSERT
1160 #define NS_VK_DELETE nsIDOMKeyEvent::DOM_VK_DELETE
1162 // NS_VK_0 - NS_VK_9 match their ascii values
1163 #define NS_VK_0 nsIDOMKeyEvent::DOM_VK_0
1164 #define NS_VK_1 nsIDOMKeyEvent::DOM_VK_1
1165 #define NS_VK_2 nsIDOMKeyEvent::DOM_VK_2
1166 #define NS_VK_3 nsIDOMKeyEvent::DOM_VK_3
1167 #define NS_VK_4 nsIDOMKeyEvent::DOM_VK_4
1168 #define NS_VK_5 nsIDOMKeyEvent::DOM_VK_5
1169 #define NS_VK_6 nsIDOMKeyEvent::DOM_VK_6
1170 #define NS_VK_7 nsIDOMKeyEvent::DOM_VK_7
1171 #define NS_VK_8 nsIDOMKeyEvent::DOM_VK_8
1172 #define NS_VK_9 nsIDOMKeyEvent::DOM_VK_9
1174 #define NS_VK_SEMICOLON nsIDOMKeyEvent::DOM_VK_SEMICOLON
1175 #define NS_VK_EQUALS nsIDOMKeyEvent::DOM_VK_EQUALS
1177 // NS_VK_A - NS_VK_Z match their ascii values
1178 #define NS_VK_A nsIDOMKeyEvent::DOM_VK_A
1179 #define NS_VK_B nsIDOMKeyEvent::DOM_VK_B
1180 #define NS_VK_C nsIDOMKeyEvent::DOM_VK_C
1181 #define NS_VK_D nsIDOMKeyEvent::DOM_VK_D
1182 #define NS_VK_E nsIDOMKeyEvent::DOM_VK_E
1183 #define NS_VK_F nsIDOMKeyEvent::DOM_VK_F
1184 #define NS_VK_G nsIDOMKeyEvent::DOM_VK_G
1185 #define NS_VK_H nsIDOMKeyEvent::DOM_VK_H
1186 #define NS_VK_I nsIDOMKeyEvent::DOM_VK_I
1187 #define NS_VK_J nsIDOMKeyEvent::DOM_VK_J
1188 #define NS_VK_K nsIDOMKeyEvent::DOM_VK_K
1189 #define NS_VK_L nsIDOMKeyEvent::DOM_VK_L
1190 #define NS_VK_M nsIDOMKeyEvent::DOM_VK_M
1191 #define NS_VK_N nsIDOMKeyEvent::DOM_VK_N
1192 #define NS_VK_O nsIDOMKeyEvent::DOM_VK_O
1193 #define NS_VK_P nsIDOMKeyEvent::DOM_VK_P
1194 #define NS_VK_Q nsIDOMKeyEvent::DOM_VK_Q
1195 #define NS_VK_R nsIDOMKeyEvent::DOM_VK_R
1196 #define NS_VK_S nsIDOMKeyEvent::DOM_VK_S
1197 #define NS_VK_T nsIDOMKeyEvent::DOM_VK_T
1198 #define NS_VK_U nsIDOMKeyEvent::DOM_VK_U
1199 #define NS_VK_V nsIDOMKeyEvent::DOM_VK_V
1200 #define NS_VK_W nsIDOMKeyEvent::DOM_VK_W
1201 #define NS_VK_X nsIDOMKeyEvent::DOM_VK_X
1202 #define NS_VK_Y nsIDOMKeyEvent::DOM_VK_Y
1203 #define NS_VK_Z nsIDOMKeyEvent::DOM_VK_Z
1205 #define NS_VK_CONTEXT_MENU nsIDOMKeyEvent::DOM_VK_CONTEXT_MENU
1207 #define NS_VK_NUMPAD0 nsIDOMKeyEvent::DOM_VK_NUMPAD0
1208 #define NS_VK_NUMPAD1 nsIDOMKeyEvent::DOM_VK_NUMPAD1
1209 #define NS_VK_NUMPAD2 nsIDOMKeyEvent::DOM_VK_NUMPAD2
1210 #define NS_VK_NUMPAD3 nsIDOMKeyEvent::DOM_VK_NUMPAD3
1211 #define NS_VK_NUMPAD4 nsIDOMKeyEvent::DOM_VK_NUMPAD4
1212 #define NS_VK_NUMPAD5 nsIDOMKeyEvent::DOM_VK_NUMPAD5
1213 #define NS_VK_NUMPAD6 nsIDOMKeyEvent::DOM_VK_NUMPAD6
1214 #define NS_VK_NUMPAD7 nsIDOMKeyEvent::DOM_VK_NUMPAD7
1215 #define NS_VK_NUMPAD8 nsIDOMKeyEvent::DOM_VK_NUMPAD8
1216 #define NS_VK_NUMPAD9 nsIDOMKeyEvent::DOM_VK_NUMPAD9
1217 #define NS_VK_MULTIPLY nsIDOMKeyEvent::DOM_VK_MULTIPLY
1218 #define NS_VK_ADD nsIDOMKeyEvent::DOM_VK_ADD
1219 #define NS_VK_SEPARATOR nsIDOMKeyEvent::DOM_VK_SEPARATOR
1220 #define NS_VK_SUBTRACT nsIDOMKeyEvent::DOM_VK_SUBTRACT
1221 #define NS_VK_DECIMAL nsIDOMKeyEvent::DOM_VK_DECIMAL
1222 #define NS_VK_DIVIDE nsIDOMKeyEvent::DOM_VK_DIVIDE
1223 #define NS_VK_F1 nsIDOMKeyEvent::DOM_VK_F1
1224 #define NS_VK_F2 nsIDOMKeyEvent::DOM_VK_F2
1225 #define NS_VK_F3 nsIDOMKeyEvent::DOM_VK_F3
1226 #define NS_VK_F4 nsIDOMKeyEvent::DOM_VK_F4
1227 #define NS_VK_F5 nsIDOMKeyEvent::DOM_VK_F5
1228 #define NS_VK_F6 nsIDOMKeyEvent::DOM_VK_F6
1229 #define NS_VK_F7 nsIDOMKeyEvent::DOM_VK_F7
1230 #define NS_VK_F8 nsIDOMKeyEvent::DOM_VK_F8
1231 #define NS_VK_F9 nsIDOMKeyEvent::DOM_VK_F9
1232 #define NS_VK_F10 nsIDOMKeyEvent::DOM_VK_F10
1233 #define NS_VK_F11 nsIDOMKeyEvent::DOM_VK_F11
1234 #define NS_VK_F12 nsIDOMKeyEvent::DOM_VK_F12
1235 #define NS_VK_F13 nsIDOMKeyEvent::DOM_VK_F13
1236 #define NS_VK_F14 nsIDOMKeyEvent::DOM_VK_F14
1237 #define NS_VK_F15 nsIDOMKeyEvent::DOM_VK_F15
1238 #define NS_VK_F16 nsIDOMKeyEvent::DOM_VK_F16
1239 #define NS_VK_F17 nsIDOMKeyEvent::DOM_VK_F17
1240 #define NS_VK_F18 nsIDOMKeyEvent::DOM_VK_F18
1241 #define NS_VK_F19 nsIDOMKeyEvent::DOM_VK_F19
1242 #define NS_VK_F20 nsIDOMKeyEvent::DOM_VK_F20
1243 #define NS_VK_F21 nsIDOMKeyEvent::DOM_VK_F21
1244 #define NS_VK_F22 nsIDOMKeyEvent::DOM_VK_F22
1245 #define NS_VK_F23 nsIDOMKeyEvent::DOM_VK_F23
1246 #define NS_VK_F24 nsIDOMKeyEvent::DOM_VK_F24
1248 #define NS_VK_NUM_LOCK nsIDOMKeyEvent::DOM_VK_NUM_LOCK
1249 #define NS_VK_SCROLL_LOCK nsIDOMKeyEvent::DOM_VK_SCROLL_LOCK
1251 #define NS_VK_COMMA nsIDOMKeyEvent::DOM_VK_COMMA
1252 #define NS_VK_PERIOD nsIDOMKeyEvent::DOM_VK_PERIOD
1253 #define NS_VK_SLASH nsIDOMKeyEvent::DOM_VK_SLASH
1254 #define NS_VK_BACK_QUOTE nsIDOMKeyEvent::DOM_VK_BACK_QUOTE
1255 #define NS_VK_OPEN_BRACKET nsIDOMKeyEvent::DOM_VK_OPEN_BRACKET
1256 #define NS_VK_BACK_SLASH nsIDOMKeyEvent::DOM_VK_BACK_SLASH
1257 #define NS_VK_CLOSE_BRACKET nsIDOMKeyEvent::DOM_VK_CLOSE_BRACKET
1258 #define NS_VK_QUOTE nsIDOMKeyEvent::DOM_VK_QUOTE
1260 #define NS_VK_META nsIDOMKeyEvent::DOM_VK_META
1262 // IME Constants -- keep in synch with nsIDOMTextRange.h
1263 #define NS_TEXTRANGE_CARETPOSITION 0x01
1264 #define NS_TEXTRANGE_RAWINPUT 0X02
1265 #define NS_TEXTRANGE_SELECTEDRAWTEXT 0x03
1266 #define NS_TEXTRANGE_CONVERTEDTEXT 0x04
1267 #define NS_TEXTRANGE_SELECTEDCONVERTEDTEXT 0x05
1269 inline PRBool NS_TargetUnfocusedEventToLastFocusedContent(nsEvent* aEvent)
1271 #if defined(MOZ_X11) || defined(XP_MACOSX)
1272 // bug 52416 (MOZ_X11)
1273 // Lookup region (candidate window) of UNIX IME grabs
1274 // input focus from Mozilla but wants to send IME event
1275 // to redraw pre-edit (composed) string
1276 // If Mozilla does not have input focus and event is IME,
1277 // sends IME event to pre-focused element
1279 // bug 417315 (XP_MACOSX)
1280 // The commit event when the window is deactivating is sent after
1281 // the next focused widget getting the focus.
1282 // We need to send the commit event to last focused content.
1284 return NS_IS_IME_EVENT(aEvent);
1285 #elif defined(XP_WIN)
1286 // bug 292263 (XP_WIN)
1287 // If software keyboard has focus, it may send the key messages and
1288 // the IME messages to pre-focused window. Therefore, if Mozilla
1289 // doesn't have focus and event is key event or IME event, we should
1290 // send the events to pre-focused element.
1292 return NS_IS_KEY_EVENT(aEvent) || NS_IS_IME_EVENT(aEvent);
1293 #else
1294 return PR_FALSE;
1295 #endif
1298 #endif // nsGUIEvent_h__