| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_GLUE_WEBINPUTEVENT_H_ | 5 #ifndef WEBKIT_GLUE_WEBINPUTEVENT_H_ |
| 6 #define WEBKIT_GLUE_WEBINPUTEVENT_H_ | 6 #define WEBKIT_GLUE_WEBINPUTEVENT_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| 11 #include <windows.h> | 11 #include <windows.h> |
| 12 #elif defined(OS_MACOSX) | 12 #elif defined(OS_MACOSX) |
| 13 #include <wtf/RetainPtr.h> | 13 #include <wtf/RetainPtr.h> |
| 14 #ifdef __OBJC__ | 14 #ifdef __OBJC__ |
| 15 @class NSEvent; | 15 @class NSEvent; |
| 16 #else | 16 #else |
| 17 class NSEvent; | 17 class NSEvent; |
| 18 #endif // __OBJC__ | 18 #endif // __OBJC__ |
| 19 #endif // OS_MACOSX | 19 #elif defined(OS_LINUX) |
| 20 typedef struct _GdkEventButton GdkEventButton; |
| 21 typedef struct _GdkEventMotion GdkEventMotion; |
| 22 typedef struct _GdkEventScroll GdkEventScroll; |
| 23 typedef struct _GdkEventKey GdkEventKey; |
| 24 #endif |
| 20 | 25 |
| 21 // The classes defined in this file are intended to be used with WebView's | 26 // The classes defined in this file are intended to be used with WebView's |
| 22 // HandleInputEvent method. These event types are cross-platform; however, | 27 // HandleInputEvent method. These event types are cross-platform; however, |
| 23 // there are platform-specific constructors that accept native UI events. | 28 // there are platform-specific constructors that accept native UI events. |
| 24 // | 29 // |
| 25 // The fields of these event classes roughly correspond to the fields required | 30 // The fields of these event classes roughly correspond to the fields required |
| 26 // by WebCore's platform event classes. | 31 // by WebCore's platform event classes. |
| 27 | 32 |
| 28 // WebInputEvent -------------------------------------------------------------- | 33 // WebInputEvent -------------------------------------------------------------- |
| 29 | 34 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 int global_x; | 90 int global_x; |
| 86 int global_y; | 91 int global_y; |
| 87 double timestamp_sec; // Seconds since epoch. | 92 double timestamp_sec; // Seconds since epoch. |
| 88 int layout_test_click_count; // Only used during layout tests. | 93 int layout_test_click_count; // Only used during layout tests. |
| 89 | 94 |
| 90 WebMouseEvent() {} | 95 WebMouseEvent() {} |
| 91 #if defined(OS_WIN) | 96 #if defined(OS_WIN) |
| 92 WebMouseEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); | 97 WebMouseEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); |
| 93 #elif defined(OS_MACOSX) | 98 #elif defined(OS_MACOSX) |
| 94 WebMouseEvent(NSEvent *event); | 99 WebMouseEvent(NSEvent *event); |
| 100 #elif defined(OS_LINUX) |
| 101 explicit WebMouseEvent(const GdkEventButton* event); |
| 102 explicit WebMouseEvent(const GdkEventMotion* event); |
| 95 #endif | 103 #endif |
| 96 }; | 104 }; |
| 97 | 105 |
| 98 // WebMouseWheelEvent --------------------------------------------------------- | 106 // WebMouseWheelEvent --------------------------------------------------------- |
| 99 | 107 |
| 100 class WebMouseWheelEvent : public WebMouseEvent { | 108 class WebMouseWheelEvent : public WebMouseEvent { |
| 101 public: | 109 public: |
| 102 int delta_x; | 110 int delta_x; |
| 103 int delta_y; | 111 int delta_y; |
| 104 | 112 |
| 105 WebMouseWheelEvent() {} | 113 WebMouseWheelEvent() {} |
| 106 #if defined(OS_WIN) | 114 #if defined(OS_WIN) |
| 107 WebMouseWheelEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); | 115 WebMouseWheelEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); |
| 108 #elif defined(OS_MACOSX) | 116 #elif defined(OS_MACOSX) |
| 109 WebMouseWheelEvent(NSEvent *event); | 117 WebMouseWheelEvent(NSEvent *event); |
| 118 #elif defined(OS_LINUX) |
| 119 explicit WebMouseWheelEvent(const GdkEventScroll* event); |
| 110 #endif | 120 #endif |
| 111 }; | 121 }; |
| 112 | 122 |
| 113 // WebKeyboardEvent ----------------------------------------------------------- | 123 // WebKeyboardEvent ----------------------------------------------------------- |
| 114 | 124 |
| 115 class WebKeyboardEvent : public WebInputEvent { | 125 class WebKeyboardEvent : public WebInputEvent { |
| 116 public: | 126 public: |
| 117 int key_code; | 127 int key_code; |
| 118 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
| 119 bool system_key; // Set if we receive a SYSKEYDOWN/WM_SYSKEYUP message. | 129 bool system_key; // Set if we receive a SYSKEYDOWN/WM_SYSKEYUP message. |
| 120 MSG actual_message; // Set to the current keyboard message. | 130 MSG actual_message; // Set to the current keyboard message. |
| 121 #endif | 131 #endif |
| 122 | 132 |
| 123 WebKeyboardEvent() | 133 WebKeyboardEvent() |
| 124 : key_code(0) | 134 : key_code(0) |
| 125 #if defined(OS_WIN) | 135 #if defined(OS_WIN) |
| 126 , system_key(false) { | 136 , system_key(false) { |
| 127 memset(&actual_message, 0, sizeof(actual_message)); | 137 memset(&actual_message, 0, sizeof(actual_message)); |
| 128 } | 138 } |
| 129 #else | 139 #else |
| 130 {} | 140 {} |
| 131 #endif | 141 #endif |
| 132 | 142 |
| 133 #if defined(OS_WIN) | 143 #if defined(OS_WIN) |
| 134 WebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); | 144 WebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); |
| 135 #elif defined(OS_MACOSX) | 145 #elif defined(OS_MACOSX) |
| 136 WebKeyboardEvent(NSEvent *event); | 146 WebKeyboardEvent(NSEvent *event); |
| 147 #elif defined(OS_LINUX) |
| 148 explicit WebKeyboardEvent(const GdkEventKey* event); |
| 137 #endif | 149 #endif |
| 138 }; | 150 }; |
| 139 | 151 |
| 140 | 152 |
| 141 #endif // WEBKIT_GLUE_WEBINPUTEVENT_H_ | 153 #endif // WEBKIT_GLUE_WEBINPUTEVENT_H_ |
| OLD | NEW |