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 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" | |
10 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
11 #include "gfx/point.h" | 10 #include "gfx/point.h" |
| 11 #include "ui/base/keycodes/keyboard_codes.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 | 16 |
17 #if defined(TOUCH_UI) | 17 #if defined(TOUCH_UI) |
18 typedef union _XEvent XEvent; | 18 typedef union _XEvent XEvent; |
19 #endif | 19 #endif |
20 | 20 |
21 namespace ui { | 21 namespace ui { |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // KeyEvent class | 324 // KeyEvent class |
325 // | 325 // |
326 // A key event is used for any input event related to the keyboard. | 326 // A key event is used for any input event related to the keyboard. |
327 // Note: this event is about key pressed, not typed characters. | 327 // Note: this event is about key pressed, not typed characters. |
328 // | 328 // |
329 //////////////////////////////////////////////////////////////////////////////// | 329 //////////////////////////////////////////////////////////////////////////////// |
330 class KeyEvent : public Event { | 330 class KeyEvent : public Event { |
331 public: | 331 public: |
332 // Create a new key event | 332 // Create a new key event |
333 KeyEvent(EventType type, | 333 KeyEvent(EventType type, |
334 app::KeyboardCode key_code, | 334 ui::KeyboardCode key_code, |
335 int event_flags, | 335 int event_flags, |
336 int repeat_count, | 336 int repeat_count, |
337 int message_flags); | 337 int message_flags); |
338 | 338 |
339 #if defined(OS_WIN) | 339 #if defined(OS_WIN) |
340 KeyEvent(EventType type, | 340 KeyEvent(EventType type, |
341 app::KeyboardCode key_code, | 341 ui::KeyboardCode key_code, |
342 int event_flags, | 342 int event_flags, |
343 int repeat_count, | 343 int repeat_count, |
344 int message_flags, | 344 int message_flags, |
345 UINT message); | 345 UINT message); |
346 #endif | 346 #endif |
347 #if defined(OS_LINUX) | 347 #if defined(OS_LINUX) |
348 explicit KeyEvent(const GdkEventKey* event); | 348 explicit KeyEvent(const GdkEventKey* event); |
349 | 349 |
350 const GdkEventKey* native_event() const { return native_event_; } | 350 const GdkEventKey* native_event() const { return native_event_; } |
351 #endif | 351 #endif |
352 #if defined(TOUCH_UI) | 352 #if defined(TOUCH_UI) |
353 // Create a key event from an X key event. | 353 // Create a key event from an X key event. |
354 explicit KeyEvent(XEvent* xevent); | 354 explicit KeyEvent(XEvent* xevent); |
355 #endif | 355 #endif |
356 | 356 |
357 // This returns a VKEY_ value as defined in app/keyboard_codes.h which is | 357 // This returns a VKEY_ value as defined in app/keyboard_codes.h which is |
358 // the Windows value. | 358 // the Windows value. |
359 // On GTK, you can use the methods in keyboard_code_conversion_gtk.cc to | 359 // On GTK, you can use the methods in keyboard_code_conversion_gtk.cc to |
360 // convert this value back to a GDK value if needed. | 360 // convert this value back to a GDK value if needed. |
361 app::KeyboardCode GetKeyCode() const { | 361 ui::KeyboardCode GetKeyCode() const { |
362 return key_code_; | 362 return key_code_; |
363 } | 363 } |
364 | 364 |
365 #if defined(OS_WIN) | 365 #if defined(OS_WIN) |
366 bool IsExtendedKey() const; | 366 bool IsExtendedKey() const; |
367 | 367 |
368 UINT message() const { | 368 UINT message() const { |
369 return message_; | 369 return message_; |
370 } | 370 } |
371 #endif | 371 #endif |
372 | 372 |
373 int GetRepeatCount() const { | 373 int GetRepeatCount() const { |
374 return repeat_count_; | 374 return repeat_count_; |
375 } | 375 } |
376 | 376 |
377 #if defined(OS_WIN) | 377 #if defined(OS_WIN) |
378 static int GetKeyStateFlags(); | 378 static int GetKeyStateFlags(); |
379 #endif | 379 #endif |
380 | 380 |
381 private: | 381 private: |
382 | 382 |
383 app::KeyboardCode key_code_; | 383 ui::KeyboardCode key_code_; |
384 int repeat_count_; | 384 int repeat_count_; |
385 int message_flags_; | 385 int message_flags_; |
386 #if defined(OS_WIN) | 386 #if defined(OS_WIN) |
387 UINT message_; | 387 UINT message_; |
388 #elif defined(OS_LINUX) | 388 #elif defined(OS_LINUX) |
389 const GdkEventKey* native_event_; | 389 const GdkEventKey* native_event_; |
390 #endif | 390 #endif |
391 DISALLOW_COPY_AND_ASSIGN(KeyEvent); | 391 DISALLOW_COPY_AND_ASSIGN(KeyEvent); |
392 }; | 392 }; |
393 | 393 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 private: | 448 private: |
449 const OSExchangeData& data_; | 449 const OSExchangeData& data_; |
450 int source_operations_; | 450 int source_operations_; |
451 | 451 |
452 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); | 452 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); |
453 }; | 453 }; |
454 | 454 |
455 } // namespace views | 455 } // namespace views |
456 | 456 |
457 #endif // VIEWS_EVENT_H_ | 457 #endif // VIEWS_EVENT_H_ |
OLD | NEW |