Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / platform / PlatformMouseEvent.h
blob04e77b4e92f0e35d80bce8bc4c883a64f04340ac
1 /*
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef PlatformMouseEvent_h
27 #define PlatformMouseEvent_h
29 #include "platform/PlatformEvent.h"
30 #include "platform/geometry/IntPoint.h"
32 namespace blink {
34 // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified.
35 enum MouseButton { NoButton = -1, LeftButton, MiddleButton, RightButton };
37 class PlatformMouseEvent : public PlatformEvent {
38 public:
39 enum SyntheticEventType {
40 // Real mouse input events or synthetic events that behave just like real events
41 RealOrIndistinguishable,
42 // Synthetic mouse events derived from touch input
43 FromTouch,
44 // Synthetic mouse events generated without a position, for example those generated
45 // from keyboard input.
46 Positionless,
49 PlatformMouseEvent()
50 : PlatformEvent(PlatformEvent::MouseMoved)
51 , m_button(NoButton)
52 , m_clickCount(0)
53 , m_synthesized(RealOrIndistinguishable)
57 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifiers, double timestamp)
58 : PlatformEvent(type, modifiers, timestamp)
59 , m_position(position)
60 , m_globalPosition(globalPosition)
61 , m_button(button)
62 , m_clickCount(clickCount)
63 , m_synthesized(RealOrIndistinguishable)
67 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifiers, SyntheticEventType synthesized, double timestamp)
68 : PlatformEvent(type, modifiers, timestamp)
69 , m_position(position)
70 , m_globalPosition(globalPosition)
71 , m_button(button)
72 , m_clickCount(clickCount)
73 , m_synthesized(synthesized)
77 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, SyntheticEventType synthesized, double timestamp)
78 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
79 , m_position(position)
80 , m_globalPosition(globalPosition)
81 , m_button(button)
82 , m_clickCount(clickCount)
83 , m_synthesized(synthesized)
87 const IntPoint& position() const { return m_position; }
88 const IntPoint& globalPosition() const { return m_globalPosition; }
89 const IntPoint& movementDelta() const { return m_movementDelta; }
91 MouseButton button() const { return m_button; }
92 int clickCount() const { return m_clickCount; }
93 bool fromTouch() const { return m_synthesized == FromTouch; }
94 SyntheticEventType syntheticEventType() const { return m_synthesized; }
96 protected:
97 IntPoint m_position;
98 IntPoint m_globalPosition;
99 IntPoint m_movementDelta;
100 MouseButton m_button;
101 int m_clickCount;
102 SyntheticEventType m_synthesized;
105 } // namespace blink
107 #endif // PlatformMouseEvent_h