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 #include "views/widget/widget_win.h" | 5 #include "views/widget/widget_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
11 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 11 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
12 #include "ui/base/l10n/l10n_util_win.h" | 12 #include "ui/base/l10n/l10n_util_win.h" |
13 #include "ui/base/system_monitor/system_monitor.h" | 13 #include "ui/base/system_monitor/system_monitor.h" |
14 #include "ui/base/theme_provider.h" | 14 #include "ui/base/theme_provider.h" |
15 #include "ui/base/view_prop.h" | 15 #include "ui/base/view_prop.h" |
16 #include "ui/base/win/hwnd_util.h" | 16 #include "ui/base/win/hwnd_util.h" |
17 #include "ui/gfx/canvas_skia.h" | 17 #include "ui/gfx/canvas_skia.h" |
18 #include "ui/gfx/native_theme_win.h" | 18 #include "ui/gfx/native_theme_win.h" |
19 #include "ui/gfx/path.h" | 19 #include "ui/gfx/path.h" |
20 #include "views/accessibility/view_accessibility.h" | 20 #include "views/accessibility/view_accessibility.h" |
21 #include "views/controls/native_control_win.h" | 21 #include "views/controls/native_control_win.h" |
| 22 #include "views/focus/accelerator_handler.h" |
22 #include "views/focus/focus_util_win.h" | 23 #include "views/focus/focus_util_win.h" |
23 #include "views/views_delegate.h" | 24 #include "views/views_delegate.h" |
24 #include "views/widget/aero_tooltip_manager.h" | 25 #include "views/widget/aero_tooltip_manager.h" |
25 #include "views/widget/child_window_message_processor.h" | 26 #include "views/widget/child_window_message_processor.h" |
26 #include "views/widget/default_theme_provider.h" | 27 #include "views/widget/default_theme_provider.h" |
27 #include "views/widget/drop_target_win.h" | 28 #include "views/widget/drop_target_win.h" |
28 #include "views/widget/root_view.h" | 29 #include "views/widget/root_view.h" |
29 #include "views/widget/widget_delegate.h" | 30 #include "views/widget/widget_delegate.h" |
30 #include "views/widget/widget_utils.h" | 31 #include "views/widget/widget_utils.h" |
31 #include "views/window/window_win.h" | 32 #include "views/window/window_win.h" |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 SetMsgHandled(FALSE); | 683 SetMsgHandled(FALSE); |
683 } | 684 } |
684 | 685 |
685 void WidgetWin::OnInitMenuPopup(HMENU menu, | 686 void WidgetWin::OnInitMenuPopup(HMENU menu, |
686 UINT position, | 687 UINT position, |
687 BOOL is_system_menu) { | 688 BOOL is_system_menu) { |
688 SetMsgHandled(FALSE); | 689 SetMsgHandled(FALSE); |
689 } | 690 } |
690 | 691 |
691 void WidgetWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) { | 692 void WidgetWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) { |
692 KeyEvent event(ui::ET_KEY_PRESSED, ui::KeyboardCodeForWindowsKeyCode(c), | 693 KeyEvent event(AcceleratorHandler::current_message()); |
693 KeyEvent::GetKeyStateFlags(), rep_cnt, flags, | |
694 WM_KEYDOWN); | |
695 RootView* root_view = GetFocusedViewRootView(); | 694 RootView* root_view = GetFocusedViewRootView(); |
696 if (!root_view) | 695 if (!root_view) |
697 root_view = root_view_.get(); | 696 root_view = root_view_.get(); |
698 | 697 |
699 SetMsgHandled(root_view->ProcessKeyEvent(event)); | 698 SetMsgHandled(root_view->ProcessKeyEvent(event)); |
700 } | 699 } |
701 | 700 |
702 void WidgetWin::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) { | 701 void WidgetWin::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) { |
703 KeyEvent event(ui::ET_KEY_RELEASED, ui::KeyboardCodeForWindowsKeyCode(c), | 702 KeyEvent event(AcceleratorHandler::current_message()); |
704 KeyEvent::GetKeyStateFlags(), rep_cnt, flags, | |
705 WM_KEYUP); | |
706 RootView* root_view = GetFocusedViewRootView(); | 703 RootView* root_view = GetFocusedViewRootView(); |
707 if (!root_view) | 704 if (!root_view) |
708 root_view = root_view_.get(); | 705 root_view = root_view_.get(); |
709 | 706 |
710 SetMsgHandled(root_view->ProcessKeyEvent(event)); | 707 SetMsgHandled(root_view->ProcessKeyEvent(event)); |
711 } | 708 } |
712 | 709 |
713 void WidgetWin::OnKillFocus(HWND focused_window) { | 710 void WidgetWin::OnKillFocus(HWND focused_window) { |
714 GetFocusManager()->GetWidgetFocusManager()->OnWidgetFocusEvent( | 711 GetFocusManager()->GetWidgetFocusManager()->OnWidgetFocusEvent( |
715 this->GetNativeView(), | 712 this->GetNativeView(), |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { | 1382 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { |
1386 return Widget::GetWidgetFromNativeView(native_window); | 1383 return Widget::GetWidgetFromNativeView(native_window); |
1387 } | 1384 } |
1388 | 1385 |
1389 // static | 1386 // static |
1390 void Widget::NotifyLocaleChanged() { | 1387 void Widget::NotifyLocaleChanged() { |
1391 NOTIMPLEMENTED(); | 1388 NOTIMPLEMENTED(); |
1392 } | 1389 } |
1393 | 1390 |
1394 } // namespace views | 1391 } // namespace views |
OLD | NEW |