OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition,
MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie
rs, double timestamp) | 55 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition,
MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie
rs, double timestamp) |
56 : PlatformEvent(type, modifiers, timestamp) | 56 : PlatformEvent(type, modifiers, timestamp) |
57 , m_position(position) | 57 , m_position(position) |
58 , m_globalPosition(globalPosition) | 58 , m_globalPosition(globalPosition) |
59 , m_button(button) | 59 , m_button(button) |
60 , m_clickCount(clickCount) | 60 , m_clickCount(clickCount) |
61 , m_synthesized(RealOrIndistinguishable) | 61 , m_synthesized(RealOrIndistinguishable) |
62 , m_modifierFlags(0) | 62 , m_modifierFlags(0) |
63 { | 63 { |
| 64 addModifierFromButton(button); |
64 } | 65 } |
65 | 66 |
66 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition,
MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie
rs, SyntheticEventType synthesized, double timestamp) | 67 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition,
MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie
rs, SyntheticEventType synthesized, double timestamp) |
67 : PlatformEvent(type, modifiers, timestamp) | 68 : PlatformEvent(type, modifiers, timestamp) |
68 , m_position(position) | 69 , m_position(position) |
69 , m_globalPosition(globalPosition) | 70 , m_globalPosition(globalPosition) |
70 , m_button(button) | 71 , m_button(button) |
71 , m_clickCount(clickCount) | 72 , m_clickCount(clickCount) |
72 , m_synthesized(synthesized) | 73 , m_synthesized(synthesized) |
73 , m_modifierFlags(0) | 74 , m_modifierFlags(0) |
74 { | 75 { |
| 76 addModifierFromButton(button); |
75 } | 77 } |
76 | 78 |
77 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition,
MouseButton button, PlatformEvent::Type type, int clickCount, bool shiftKey, bo
ol ctrlKey, bool altKey, bool metaKey, SyntheticEventType synthesized, double ti
mestamp) | 79 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition,
MouseButton button, PlatformEvent::Type type, int clickCount, bool shiftKey, bo
ol ctrlKey, bool altKey, bool metaKey, SyntheticEventType synthesized, double ti
mestamp) |
78 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) | 80 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) |
79 , m_position(position) | 81 , m_position(position) |
80 , m_globalPosition(globalPosition) | 82 , m_globalPosition(globalPosition) |
81 , m_button(button) | 83 , m_button(button) |
82 , m_clickCount(clickCount) | 84 , m_clickCount(clickCount) |
83 , m_synthesized(synthesized) | 85 , m_synthesized(synthesized) |
84 , m_modifierFlags(0) | 86 , m_modifierFlags(0) |
85 { | 87 { |
| 88 addModifierFromButton(button); |
86 } | 89 } |
87 | 90 |
88 const IntPoint& position() const { return m_position; } | 91 const IntPoint& position() const { return m_position; } |
89 const IntPoint& globalPosition() const { return m_globalPosition; } | 92 const IntPoint& globalPosition() const { return m_globalPosition; } |
90 const IntPoint& movementDelta() const { return m_movementDelta; } | 93 const IntPoint& movementDelta() const { return m_movementDelta; } |
91 | 94 |
92 MouseButton button() const { return m_button; } | 95 MouseButton button() const { return m_button; } |
93 int clickCount() const { return m_clickCount; } | 96 int clickCount() const { return m_clickCount; } |
94 unsigned modifierFlags() const { return m_modifierFlags; } | 97 unsigned modifierFlags() const { return m_modifierFlags; } |
95 bool fromTouch() const { return m_synthesized == FromTouch; } | 98 bool fromTouch() const { return m_synthesized == FromTouch; } |
96 SyntheticEventType syntheticEventType() const { return m_synthesized; } | 99 SyntheticEventType syntheticEventType() const { return m_synthesized; } |
97 | 100 |
| 101 private: |
| 102 void addModifierFromButton(MouseButton button) |
| 103 { |
| 104 if (!fromTouch() || button == NoButton) |
| 105 return; |
| 106 |
| 107 const unsigned map[] = { |
| 108 LeftButtonDown, MiddleButtonDown, RightButtonDown |
| 109 }; |
| 110 m_modifiers |= map[button]; |
| 111 } |
| 112 |
98 protected: | 113 protected: |
99 IntPoint m_position; | 114 IntPoint m_position; |
100 IntPoint m_globalPosition; | 115 IntPoint m_globalPosition; |
101 IntPoint m_movementDelta; | 116 IntPoint m_movementDelta; |
102 MouseButton m_button; | 117 MouseButton m_button; |
103 int m_clickCount; | 118 int m_clickCount; |
104 SyntheticEventType m_synthesized; | 119 SyntheticEventType m_synthesized; |
105 unsigned m_modifierFlags; | 120 unsigned m_modifierFlags; |
106 }; | 121 }; |
107 | 122 |
108 } // namespace blink | 123 } // namespace blink |
109 | 124 |
110 #endif // PlatformMouseEvent_h | 125 #endif // PlatformMouseEvent_h |
OLD | NEW |