OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ACCESSIBLE_PANE_VIEW_H_ | 5 #ifndef VIEWS_ACCESSIBLE_PANE_VIEW_H_ |
6 #define VIEWS_ACCESSIBLE_PANE_VIEW_H_ | 6 #define VIEWS_ACCESSIBLE_PANE_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "ui/base/models/accelerator.h" |
12 #include "views/focus/focus_manager.h" | 13 #include "views/focus/focus_manager.h" |
13 #include "views/view.h" | 14 #include "views/view.h" |
14 | 15 |
15 namespace views { | 16 namespace views { |
16 class FocusSearch; | 17 class FocusSearch; |
17 | 18 |
18 // This class provides keyboard access to any view that extends it, typically | 19 // This class provides keyboard access to any view that extends it, typically |
19 // a toolbar. The user sets focus to a control in this view by pressing | 20 // a toolbar. The user sets focus to a control in this view by pressing |
20 // F6 to traverse all panes, or by pressing a shortcut that jumps directly | 21 // F6 to traverse all panes, or by pressing a shortcut that jumps directly |
21 // to this pane. | 22 // to this pane. |
(...skipping 12 matching lines...) Expand all Loading... |
34 virtual bool SetPaneFocus(View* initial_focus); | 35 virtual bool SetPaneFocus(View* initial_focus); |
35 | 36 |
36 // Set focus to the pane with complete keyboard access, with the | 37 // Set focus to the pane with complete keyboard access, with the |
37 // focus initially set to the default child. Focus will be restored | 38 // focus initially set to the default child. Focus will be restored |
38 // to the last focused view if the user escapes. | 39 // to the last focused view if the user escapes. |
39 // Returns true if the pane was able to receive focus. | 40 // Returns true if the pane was able to receive focus. |
40 virtual bool SetPaneFocusAndFocusDefault(); | 41 virtual bool SetPaneFocusAndFocusDefault(); |
41 | 42 |
42 // Overridden from View: | 43 // Overridden from View: |
43 virtual FocusTraversable* GetPaneFocusTraversable() OVERRIDE; | 44 virtual FocusTraversable* GetPaneFocusTraversable() OVERRIDE; |
44 virtual bool AcceleratorPressed(const Accelerator& accelerator) | 45 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) |
45 OVERRIDE; | 46 OVERRIDE; |
46 virtual void SetVisible(bool flag) OVERRIDE; | 47 virtual void SetVisible(bool flag) OVERRIDE; |
47 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 48 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
48 | 49 |
49 // Overridden from FocusChangeListener: | 50 // Overridden from FocusChangeListener: |
50 virtual void OnWillChangeFocus(View* focused_before, | 51 virtual void OnWillChangeFocus(View* focused_before, |
51 View* focused_now) OVERRIDE; | 52 View* focused_now) OVERRIDE; |
52 virtual void OnDidChangeFocus(View* focused_before, | 53 virtual void OnDidChangeFocus(View* focused_before, |
53 View* focused_now) OVERRIDE; | 54 View* focused_now) OVERRIDE; |
54 | 55 |
(...skipping 22 matching lines...) Expand all Loading... |
77 // Save the focus manager rather than calling GetFocusManager(), | 78 // Save the focus manager rather than calling GetFocusManager(), |
78 // so that we can remove focus listeners in the destructor. | 79 // so that we can remove focus listeners in the destructor. |
79 FocusManager* focus_manager_; | 80 FocusManager* focus_manager_; |
80 | 81 |
81 // Our custom focus search implementation that traps focus in this | 82 // Our custom focus search implementation that traps focus in this |
82 // pane and traverses all views that are focusable for accessibility, | 83 // pane and traverses all views that are focusable for accessibility, |
83 // not just those that are normally focusable. | 84 // not just those that are normally focusable. |
84 scoped_ptr<FocusSearch> focus_search_; | 85 scoped_ptr<FocusSearch> focus_search_; |
85 | 86 |
86 // Registered accelerators | 87 // Registered accelerators |
87 Accelerator home_key_; | 88 ui::Accelerator home_key_; |
88 Accelerator end_key_; | 89 ui::Accelerator end_key_; |
89 Accelerator escape_key_; | 90 ui::Accelerator escape_key_; |
90 Accelerator left_key_; | 91 ui::Accelerator left_key_; |
91 Accelerator right_key_; | 92 ui::Accelerator right_key_; |
92 | 93 |
93 DISALLOW_COPY_AND_ASSIGN(AccessiblePaneView); | 94 DISALLOW_COPY_AND_ASSIGN(AccessiblePaneView); |
94 }; | 95 }; |
95 | 96 |
96 } // namespace views | 97 } // namespace views |
97 | 98 |
98 #endif // VIEWS_ACCESSIBLE_PANE_VIEW_H_ | 99 #endif // VIEWS_ACCESSIBLE_PANE_VIEW_H_ |
OLD | NEW |