OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_VIEW_H_ | 5 #ifndef UI_VIEWS_VIEW_H_ |
6 #define UI_VIEWS_VIEW_H_ | 6 #define UI_VIEWS_VIEW_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 namespace gfx { | 35 namespace gfx { |
36 class Canvas; | 36 class Canvas; |
37 class Insets; | 37 class Insets; |
38 class Path; | 38 class Path; |
39 } | 39 } |
40 | 40 |
41 namespace ui { | 41 namespace ui { |
42 struct AccessibleViewState; | 42 struct AccessibleViewState; |
43 class Compositor; | 43 class Compositor; |
| 44 class KeyEvent; |
44 class Layer; | 45 class Layer; |
45 class TextInputClient; | 46 class TextInputClient; |
46 class Texture; | 47 class Texture; |
47 class ThemeProvider; | 48 class ThemeProvider; |
48 class Transform; | 49 class Transform; |
49 } | 50 } |
50 | 51 |
51 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
52 class __declspec(uuid("26f5641a-246d-457b-a96d-07f3fae6acf2")) | 53 class __declspec(uuid("26f5641a-246d-457b-a96d-07f3fae6acf2")) |
53 NativeViewAccessibilityWin; | 54 NativeViewAccessibilityWin; |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 // Note: if the mouse handler is no longer connected to a | 607 // Note: if the mouse handler is no longer connected to a |
607 // view hierarchy, events won't be sent. | 608 // view hierarchy, events won't be sent. |
608 // | 609 // |
609 // TODO(sky): rename this. | 610 // TODO(sky): rename this. |
610 virtual void SetMouseHandler(View* new_mouse_handler); | 611 virtual void SetMouseHandler(View* new_mouse_handler); |
611 | 612 |
612 // Invoked when a key is pressed or released. | 613 // Invoked when a key is pressed or released. |
613 // Subclasser should return true if the event has been processed and false | 614 // Subclasser should return true if the event has been processed and false |
614 // otherwise. If the event has not been processed, the parent will be given a | 615 // otherwise. If the event has not been processed, the parent will be given a |
615 // chance. | 616 // chance. |
616 virtual bool OnKeyPressed(const KeyEvent& event); | 617 virtual bool OnKeyPressed(const ui::KeyEvent& event); |
617 virtual bool OnKeyReleased(const KeyEvent& event); | 618 virtual bool OnKeyReleased(const ui::KeyEvent& event); |
618 | 619 |
619 // Invoked when the user uses the mousewheel. Implementors should return true | 620 // Invoked when the user uses the mousewheel. Implementors should return true |
620 // if the event has been processed and false otherwise. This message is sent | 621 // if the event has been processed and false otherwise. This message is sent |
621 // if the view is focused. If the event has not been processed, the parent | 622 // if the view is focused. If the event has not been processed, the parent |
622 // will be given a chance. | 623 // will be given a chance. |
623 virtual bool OnMouseWheel(const MouseWheelEvent& event); | 624 virtual bool OnMouseWheel(const MouseWheelEvent& event); |
624 | 625 |
625 // Invoked when user scrolls (e.g. using two-finger scroll on touch pad). | 626 // Invoked when user scrolls (e.g. using two-finger scroll on touch pad). |
626 // Returns true if the event has been processed and false otherwise. The event | 627 // Returns true if the event has been processed and false otherwise. The event |
627 // is sent to the view where the event happens first. If it has not been | 628 // is sent to the view where the event happens first. If it has not been |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 | 727 |
727 // Invoked when a key is pressed before the key event is processed (and | 728 // Invoked when a key is pressed before the key event is processed (and |
728 // potentially eaten) by the focus manager for tab traversal, accelerators and | 729 // potentially eaten) by the focus manager for tab traversal, accelerators and |
729 // other focus related actions. | 730 // other focus related actions. |
730 // The default implementation returns false, ensuring that tab traversal and | 731 // The default implementation returns false, ensuring that tab traversal and |
731 // accelerators processing is performed. | 732 // accelerators processing is performed. |
732 // Subclasses should return true if they want to process the key event and not | 733 // Subclasses should return true if they want to process the key event and not |
733 // have it processed as an accelerator (if any) or as a tab traversal (if the | 734 // have it processed as an accelerator (if any) or as a tab traversal (if the |
734 // key event is for the TAB key). In that case, OnKeyPressed will | 735 // key event is for the TAB key). In that case, OnKeyPressed will |
735 // subsequently be invoked for that event. | 736 // subsequently be invoked for that event. |
736 virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& event); | 737 virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event); |
737 | 738 |
738 // Subclasses that contain traversable children that are not directly | 739 // Subclasses that contain traversable children that are not directly |
739 // accessible through the children hierarchy should return the associated | 740 // accessible through the children hierarchy should return the associated |
740 // FocusTraversable for the focus traversal to work properly. | 741 // FocusTraversable for the focus traversal to work properly. |
741 virtual FocusTraversable* GetFocusTraversable(); | 742 virtual FocusTraversable* GetFocusTraversable(); |
742 | 743 |
743 // Subclasses that can act as a "pane" must implement their own | 744 // Subclasses that can act as a "pane" must implement their own |
744 // FocusTraversable to keep the focus trapped within the pane. | 745 // FocusTraversable to keep the focus trapped within the pane. |
745 // If this method returns an object, any view that's a direct or | 746 // If this method returns an object, any view that's a direct or |
746 // indirect child of this view will always use this FocusTraversable | 747 // indirect child of this view will always use this FocusTraversable |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 base::win::ScopedComPtr<NativeViewAccessibilityWin> | 1469 base::win::ScopedComPtr<NativeViewAccessibilityWin> |
1469 native_view_accessibility_win_; | 1470 native_view_accessibility_win_; |
1470 #endif | 1471 #endif |
1471 | 1472 |
1472 DISALLOW_COPY_AND_ASSIGN(View); | 1473 DISALLOW_COPY_AND_ASSIGN(View); |
1473 }; | 1474 }; |
1474 | 1475 |
1475 } // namespace views | 1476 } // namespace views |
1476 | 1477 |
1477 #endif // UI_VIEWS_VIEW_H_ | 1478 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |