Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: views/event.h

Issue 3801011: touchui: Directly process key and mouse events. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: nit Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « views/controls/menu/nested_dispatcher_gtk.cc ('k') | views/event_x.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 VIEWS_EVENT_H_ 5 #ifndef VIEWS_EVENT_H_
6 #define VIEWS_EVENT_H_ 6 #define VIEWS_EVENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "app/keyboard_codes.h" 9 #include "app/keyboard_codes.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "gfx/point.h" 11 #include "gfx/point.h"
12 12
13 #if defined(OS_LINUX) 13 #if defined(OS_LINUX)
14 typedef struct _GdkEventKey GdkEventKey; 14 typedef struct _GdkEventKey GdkEventKey;
15 #endif 15 #endif
16 #if defined(TOUCH_UI)
17 typedef union _XEvent XEvent;
18 #endif
16 19
17 class OSExchangeData; 20 class OSExchangeData;
18 21
19 namespace views { 22 namespace views {
20 23
21 class View; 24 class View;
22 25
23 //////////////////////////////////////////////////////////////////////////////// 26 ////////////////////////////////////////////////////////////////////////////////
24 // 27 //
25 // Event class 28 // Event class
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 View* from, 218 View* from,
216 View* to, 219 View* to,
217 const gfx::Point &l, 220 const gfx::Point &l,
218 int flags); 221 int flags);
219 222
220 // Create a new MouseEvent which is identical to the provided model. 223 // Create a new MouseEvent which is identical to the provided model.
221 // If from / to views are provided, the model location will be converted 224 // If from / to views are provided, the model location will be converted
222 // from 'from' coordinate system to 'to' coordinate system 225 // from 'from' coordinate system to 'to' coordinate system
223 MouseEvent(const MouseEvent& model, View* from, View* to); 226 MouseEvent(const MouseEvent& model, View* from, View* to);
224 227
228 #if defined(TOUCH_UI)
229 // Create a mouse event from an X mouse event.
230 explicit MouseEvent(XEvent* xevent);
231 #endif
232
225 // Conveniences to quickly test what button is down 233 // Conveniences to quickly test what button is down
226 bool IsOnlyLeftMouseButton() const { 234 bool IsOnlyLeftMouseButton() const {
227 return (GetFlags() & EF_LEFT_BUTTON_DOWN) && 235 return (GetFlags() & EF_LEFT_BUTTON_DOWN) &&
228 !(GetFlags() & (EF_MIDDLE_BUTTON_DOWN | EF_RIGHT_BUTTON_DOWN)); 236 !(GetFlags() & (EF_MIDDLE_BUTTON_DOWN | EF_RIGHT_BUTTON_DOWN));
229 } 237 }
230 238
231 bool IsLeftMouseButton() const { 239 bool IsLeftMouseButton() const {
232 return (GetFlags() & EF_LEFT_BUTTON_DOWN) != 0; 240 return (GetFlags() & EF_LEFT_BUTTON_DOWN) != 0;
233 } 241 }
234 242
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // Create a new key event 319 // Create a new key event
312 KeyEvent(EventType type, 320 KeyEvent(EventType type,
313 app::KeyboardCode key_code, 321 app::KeyboardCode key_code,
314 int event_flags, 322 int event_flags,
315 int repeat_count, 323 int repeat_count,
316 int message_flags); 324 int message_flags);
317 #if defined(OS_LINUX) 325 #if defined(OS_LINUX)
318 explicit KeyEvent(GdkEventKey* event); 326 explicit KeyEvent(GdkEventKey* event);
319 #endif 327 #endif
320 328
329 #if defined(TOUCH_UI)
330 // Create a key event from an X key event.
331 explicit KeyEvent(XEvent* xevent);
332 #endif
333
321 // This returns a VKEY_ value as defined in app/keyboard_codes.h which is 334 // This returns a VKEY_ value as defined in app/keyboard_codes.h which is
322 // the Windows value. 335 // the Windows value.
323 // On GTK, you can use the methods in keyboard_code_conversion_gtk.cc to 336 // On GTK, you can use the methods in keyboard_code_conversion_gtk.cc to
324 // convert this value back to a GDK value if needed. 337 // convert this value back to a GDK value if needed.
325 app::KeyboardCode GetKeyCode() const { 338 app::KeyboardCode GetKeyCode() const {
326 return key_code_; 339 return key_code_;
327 } 340 }
328 341
329 #if defined(OS_WIN) 342 #if defined(OS_WIN)
330 bool IsExtendedKey() const; 343 bool IsExtendedKey() const;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 private: 414 private:
402 const OSExchangeData& data_; 415 const OSExchangeData& data_;
403 int source_operations_; 416 int source_operations_;
404 417
405 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); 418 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent);
406 }; 419 };
407 420
408 } // namespace views 421 } // namespace views
409 422
410 #endif // VIEWS_EVENT_H_ 423 #endif // VIEWS_EVENT_H_
OLDNEW
« no previous file with comments | « views/controls/menu/nested_dispatcher_gtk.cc ('k') | views/event_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698