| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
| 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) | 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) |
| 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 * | 21 * |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #ifndef MouseEvent_h | 24 #ifndef MouseEvent_h |
| 25 #define MouseEvent_h | 25 #define MouseEvent_h |
| 26 | 26 |
| 27 #include "Clipboard.h" | 27 #include "Clipboard.h" |
| 28 #include "EventTargetNode.h" |
| 28 #include "MouseRelatedEvent.h" | 29 #include "MouseRelatedEvent.h" |
| 29 | 30 |
| 30 namespace WebCore { | 31 namespace WebCore { |
| 31 | 32 |
| 32 // Introduced in DOM Level 2 | 33 // Introduced in DOM Level 2 |
| 33 class MouseEvent : public MouseRelatedEvent { | 34 class MouseEvent : public MouseRelatedEvent { |
| 34 public: | 35 public: |
| 35 static PassRefPtr<MouseEvent> create() | 36 static PassRefPtr<MouseEvent> create() |
| 36 { | 37 { |
| 37 return adoptRef(new MouseEvent); | 38 return adoptRef(new MouseEvent); |
| 38 } | 39 } |
| 39 static PassRefPtr<MouseEvent> create(const AtomicString& type, bool canB
ubble, bool cancelable, PassRefPtr<AbstractView> view, | 40 static PassRefPtr<MouseEvent> create(const AtomicString& type, bool canB
ubble, bool cancelable, PassRefPtr<AbstractView> view, |
| 40 int detail, int screenX, int screenY, int pageX, int pageY, | 41 int detail, int screenX, int screenY, int pageX, int pageY, |
| 41 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned sho
rt button, | 42 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned sho
rt button, |
| 42 PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard> clipboa
rd = 0, bool isSimulated = false) | 43 PassRefPtr<EventTargetNode> relatedTarget, PassRefPtr<Clipboard> cli
pboard = 0, bool isSimulated = false) |
| 43 { | 44 { |
| 44 return adoptRef(new MouseEvent(type, canBubble, cancelable, view, de
tail, screenX, screenY, pageX, pageY, | 45 return adoptRef(new MouseEvent(type, canBubble, cancelable, view, de
tail, screenX, screenY, pageX, pageY, |
| 45 ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, clipb
oard, isSimulated)); | 46 ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, clipb
oard, isSimulated)); |
| 46 } | 47 } |
| 47 virtual ~MouseEvent(); | 48 virtual ~MouseEvent(); |
| 48 | 49 |
| 49 void initMouseEvent(const AtomicString& type, bool canBubble, bool cance
lable, PassRefPtr<AbstractView>, | 50 void initMouseEvent(const AtomicString& type, bool canBubble, bool cance
lable, PassRefPtr<AbstractView>, |
| 50 int detail, int screenX, int screenY, int clientX, i
nt clientY, | 51 int detail, int screenX, int screenY, int clientX, i
nt clientY, |
| 51 bool ctrlKey, bool altKey, bool shiftKey, bool metaK
ey, | 52 bool ctrlKey, bool altKey, bool shiftKey, bool metaK
ey, |
| 52 unsigned short button, PassRefPtr<EventTarget> relat
edTarget); | 53 unsigned short button, PassRefPtr<EventTargetNode> r
elatedTarget); |
| 53 | 54 |
| 54 // WinIE uses 1,4,2 for left/middle/right but not for click (just for mo
usedown/up, maybe others), | 55 // WinIE uses 1,4,2 for left/middle/right but not for click (just for mo
usedown/up, maybe others), |
| 55 // but we will match the standard DOM. | 56 // but we will match the standard DOM. |
| 56 unsigned short button() const { return m_button; } | 57 unsigned short button() const { return m_button; } |
| 57 bool buttonDown() const { return m_buttonDown; } | 58 bool buttonDown() const { return m_buttonDown; } |
| 58 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } | 59 EventTargetNode* relatedTarget() const { return m_relatedTarget.get(); } |
| 59 | 60 |
| 60 Clipboard* clipboard() const { return m_clipboard.get(); } | 61 Clipboard* clipboard() const { return m_clipboard.get(); } |
| 61 | 62 |
| 62 Node* toElement() const; | 63 Node* toElement() const; |
| 63 Node* fromElement() const; | 64 Node* fromElement() const; |
| 64 | 65 |
| 65 Clipboard* dataTransfer() const { return isDragEvent() ? m_clipboard.get
() : 0; } | 66 Clipboard* dataTransfer() const { return isDragEvent() ? m_clipboard.get
() : 0; } |
| 66 | 67 |
| 67 virtual bool isMouseEvent() const; | 68 virtual bool isMouseEvent() const; |
| 68 virtual bool isDragEvent() const; | 69 virtual bool isDragEvent() const; |
| 69 virtual int which() const; | 70 virtual int which() const; |
| 70 | 71 |
| 71 private: | 72 private: |
| 72 MouseEvent(); | 73 MouseEvent(); |
| 73 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, Pa
ssRefPtr<AbstractView>, | 74 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, Pa
ssRefPtr<AbstractView>, |
| 74 int detail, int screenX, int screenY, int pageX, int pageY, | 75 int detail, int screenX, int screenY, int pageX, int pageY, |
| 75 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsig
ned short button, | 76 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsig
ned short button, |
| 76 PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard>
clipboard, bool isSimulated); | 77 PassRefPtr<EventTargetNode> relatedTarget, PassRefPtr<Clipboa
rd> clipboard, bool isSimulated); |
| 77 | 78 |
| 78 unsigned short m_button; | 79 unsigned short m_button; |
| 79 bool m_buttonDown; | 80 bool m_buttonDown; |
| 80 RefPtr<EventTarget> m_relatedTarget; | 81 RefPtr<EventTargetNode> m_relatedTarget; |
| 81 RefPtr<Clipboard> m_clipboard; | 82 RefPtr<Clipboard> m_clipboard; |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace WebCore | 85 } // namespace WebCore |
| 85 | 86 |
| 86 #endif // MouseEvent_h | 87 #endif // MouseEvent_h |
| OLD | NEW |