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_FOCUS_FOCUS_MANAGER_H_ | 5 #ifndef VIEWS_FOCUS_FOCUS_MANAGER_H_ |
6 #define VIEWS_FOCUS_FOCUS_MANAGER_H_ | 6 #define VIEWS_FOCUS_FOCUS_MANAGER_H_ |
7 | 7 |
8 #if defined(OS_WIN) | |
9 #include <windows.h> | |
10 #endif | |
11 #include <vector> | 8 #include <vector> |
12 #include <map> | 9 #include <map> |
13 #include <list> | 10 #include <list> |
14 | 11 |
15 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
16 #include "base/gfx/native_widget_types.h" | 13 #include "base/gfx/native_widget_types.h" |
17 #include "views/accelerator.h" | 14 #include "views/accelerator.h" |
18 | 15 |
19 // The FocusManager class is used to handle focus traversal, store/restore | 16 // The FocusManager class is used to handle focus traversal, store/restore |
20 // focused views and handle keyboard accelerators. | 17 // focused views and handle keyboard accelerators. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 class FocusChangeListener { | 130 class FocusChangeListener { |
134 public: | 131 public: |
135 virtual void FocusWillChange(View* focused_before, View* focused_now) = 0; | 132 virtual void FocusWillChange(View* focused_before, View* focused_now) = 0; |
136 }; | 133 }; |
137 | 134 |
138 class FocusManager { | 135 class FocusManager { |
139 public: | 136 public: |
140 explicit FocusManager(Widget* widget); | 137 explicit FocusManager(Widget* widget); |
141 ~FocusManager(); | 138 ~FocusManager(); |
142 | 139 |
143 #if defined(OS_WIN) | 140 // Processes the passed key event for accelerators and tab traversal. |
144 // OnKeyDown covers WM_KEYDOWN and WM_SYSKEYDOWN. | 141 // Returns false if the event has been consumed and should not be processed |
145 bool OnKeyDown(HWND window, | 142 // further. |
146 UINT message, | 143 bool OnKeyEvent(const KeyEvent& event); |
147 WPARAM wparam, | |
148 LPARAM lparam); | |
149 #endif | |
150 | 144 |
151 // Returns true is the specified is part of the hierarchy of the window | 145 // Returns true is the specified is part of the hierarchy of the window |
152 // associated with this FocusManager. | 146 // associated with this FocusManager. |
153 bool ContainsView(View* view); | 147 bool ContainsView(View* view); |
154 | 148 |
155 // Advances the focus (backward if reverse is true). | 149 // Advances the focus (backward if reverse is true). |
156 void AdvanceFocus(bool reverse); | 150 void AdvanceFocus(bool reverse); |
157 | 151 |
158 // The FocusManager is handling the selected view for the RootView. | 152 // The FocusManager is handling the selected view for the RootView. |
159 View* GetFocusedView() const { return focused_view_; } | 153 View* GetFocusedView() const { return focused_view_; } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // The list of registered FocusChange listeners. | 257 // The list of registered FocusChange listeners. |
264 typedef std::vector<FocusChangeListener*> FocusChangeListenerList; | 258 typedef std::vector<FocusChangeListener*> FocusChangeListenerList; |
265 FocusChangeListenerList focus_change_listeners_; | 259 FocusChangeListenerList focus_change_listeners_; |
266 | 260 |
267 DISALLOW_COPY_AND_ASSIGN(FocusManager); | 261 DISALLOW_COPY_AND_ASSIGN(FocusManager); |
268 }; | 262 }; |
269 | 263 |
270 } // namespace views | 264 } // namespace views |
271 | 265 |
272 #endif // VIEWS_FOCUS_FOCUS_MANAGER_H_ | 266 #endif // VIEWS_FOCUS_FOCUS_MANAGER_H_ |
OLD | NEW |