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" | 9 #include "app/keyboard_codes.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 // KeyEvent class | 321 // KeyEvent class |
322 // | 322 // |
323 // A key event is used for any input event related to the keyboard. | 323 // A key event is used for any input event related to the keyboard. |
324 // Note: this event is about key pressed, not typed characters. | 324 // Note: this event is about key pressed, not typed characters. |
325 // | 325 // |
326 //////////////////////////////////////////////////////////////////////////////// | 326 //////////////////////////////////////////////////////////////////////////////// |
327 class KeyEvent : public Event { | 327 class KeyEvent : public Event { |
328 public: | 328 public: |
329 // Create a new key event | 329 // Create a new key event |
330 KeyEvent(EventType type, | 330 KeyEvent(EventType type, |
331 app::KeyboardCode key_code, | 331 app::KeyboardCode keyboard_code, |
332 int event_flags, | 332 int event_flags, |
333 int repeat_count, | 333 int repeat_count, |
334 int message_flags); | 334 int message_flags); |
335 | |
336 #if defined(OS_WIN) | |
337 KeyEvent(EventType type, | |
338 app::KeyboardCode keyboard_code, | |
339 int event_flags, | |
340 int repeat_count, | |
341 int message_flags, | |
342 UINT message); | |
343 #endif | |
335 #if defined(OS_LINUX) | 344 #if defined(OS_LINUX) |
336 explicit KeyEvent(const GdkEventKey* event); | 345 explicit KeyEvent(const GdkEventKey* event); |
337 | 346 |
338 const GdkEventKey* native_event() const { return native_event_; } | 347 const GdkEventKey* native_event() const { return native_event_; } |
339 #endif | 348 #endif |
340 | |
341 #if defined(TOUCH_UI) | 349 #if defined(TOUCH_UI) |
342 // Create a key event from an X key event. | 350 // Create a key event from an X key event. |
343 explicit KeyEvent(XEvent* xevent); | 351 explicit KeyEvent(XEvent* xevent); |
344 #endif | 352 #endif |
345 | 353 |
346 // This returns a VKEY_ value as defined in app/keyboard_codes.h which is | 354 // This returns a VKEY_ value as defined in app/keyboard_codes.h which is |
347 // the Windows value. | 355 // the Windows value. |
348 // On GTK, you can use the methods in keyboard_code_conversion_gtk.cc to | 356 // On GTK, you can use the methods in keyboard_code_conversion_gtk.cc to |
349 // convert this value back to a GDK value if needed. | 357 // convert this value back to a GDK value if needed. |
350 app::KeyboardCode GetKeyCode() const { | 358 app::KeyboardCode GetKeyCode() const { |
oshima
2011/01/04 20:26:34
I think we should rename this to GetKeyboardCode t
| |
351 return key_code_; | 359 return keyboard_code_; |
352 } | 360 } |
353 | 361 |
354 #if defined(OS_WIN) | 362 #if defined(OS_WIN) |
355 bool IsExtendedKey() const; | 363 bool IsExtendedKey() const; |
364 | |
365 UINT message() const { | |
366 return message_; | |
367 } | |
356 #endif | 368 #endif |
357 | 369 |
358 int GetRepeatCount() const { | 370 int GetRepeatCount() const { |
359 return repeat_count_; | 371 return repeat_count_; |
360 } | 372 } |
361 | 373 |
362 #if defined(OS_WIN) | 374 #if defined(OS_WIN) |
363 // Returns the current state of the KeyState. | |
364 static int GetKeyStateFlags(); | 375 static int GetKeyStateFlags(); |
365 #endif | 376 #endif |
366 | 377 |
367 private: | 378 private: |
368 | 379 |
369 app::KeyboardCode key_code_; | 380 app::KeyboardCode keyboard_code_; |
370 int repeat_count_; | 381 int repeat_count_; |
371 int message_flags_; | 382 int message_flags_; |
372 #if defined(OS_LINUX) | 383 #if defined(OS_WIN) |
384 UINT message_; | |
385 #elif defined(OS_LINUX) | |
373 const GdkEventKey* native_event_; | 386 const GdkEventKey* native_event_; |
374 #endif | 387 #endif |
375 DISALLOW_COPY_AND_ASSIGN(KeyEvent); | 388 DISALLOW_COPY_AND_ASSIGN(KeyEvent); |
376 }; | 389 }; |
377 | 390 |
378 //////////////////////////////////////////////////////////////////////////////// | 391 //////////////////////////////////////////////////////////////////////////////// |
379 // | 392 // |
380 // MouseWheelEvent class | 393 // MouseWheelEvent class |
381 // | 394 // |
382 // A MouseWheelEvent is used to propagate mouse wheel user events | 395 // A MouseWheelEvent is used to propagate mouse wheel user events |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 private: | 445 private: |
433 const OSExchangeData& data_; | 446 const OSExchangeData& data_; |
434 int source_operations_; | 447 int source_operations_; |
435 | 448 |
436 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); | 449 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); |
437 }; | 450 }; |
438 | 451 |
439 } // namespace views | 452 } // namespace views |
440 | 453 |
441 #endif // VIEWS_EVENT_H_ | 454 #endif // VIEWS_EVENT_H_ |
OLD | NEW |