OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/window/window_win.h" | 5 #include "views/window/window_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include "app/gfx/canvas_paint.h" | 10 #include "app/gfx/canvas_paint.h" |
11 #include "app/gfx/font.h" | 11 #include "app/gfx/font.h" |
12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
13 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
14 #include "app/theme_provider.h" | 14 #include "app/theme_provider.h" |
15 #include "app/win_util.h" | 15 #include "app/win_util.h" |
| 16 #include "base/i18n/rtl.h" |
16 #include "base/win_util.h" | 17 #include "base/win_util.h" |
17 #include "gfx/icon_util.h" | 18 #include "gfx/icon_util.h" |
18 #include "gfx/path.h" | 19 #include "gfx/path.h" |
19 #include "views/widget/root_view.h" | 20 #include "views/widget/root_view.h" |
20 #include "views/window/client_view.h" | 21 #include "views/window/client_view.h" |
21 #include "views/window/custom_frame_view.h" | 22 #include "views/window/custom_frame_view.h" |
22 #include "views/window/native_frame_view.h" | 23 #include "views/window/native_frame_view.h" |
23 #include "views/window/non_client_view.h" | 24 #include "views/window/non_client_view.h" |
24 #include "views/window/window_delegate.h" | 25 #include "views/window/window_delegate.h" |
25 | 26 |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 399 |
399 void WindowWin::UpdateWindowTitle() { | 400 void WindowWin::UpdateWindowTitle() { |
400 // If the non-client view is rendering its own title, it'll need to relayout | 401 // If the non-client view is rendering its own title, it'll need to relayout |
401 // now. | 402 // now. |
402 non_client_view_->Layout(); | 403 non_client_view_->Layout(); |
403 | 404 |
404 // Update the native frame's text. We do this regardless of whether or not | 405 // Update the native frame's text. We do this regardless of whether or not |
405 // the native frame is being used, since this also updates the taskbar, etc. | 406 // the native frame is being used, since this also updates the taskbar, etc. |
406 std::wstring window_title = window_delegate_->GetWindowTitle(); | 407 std::wstring window_title = window_delegate_->GetWindowTitle(); |
407 std::wstring localized_text; | 408 std::wstring localized_text; |
408 if (l10n_util::AdjustStringForLocaleDirection(window_title, &localized_text)) | 409 if (base::i18n::AdjustStringForLocaleDirection(window_title, &localized_text)) |
409 window_title.assign(localized_text); | 410 window_title.assign(localized_text); |
410 SetWindowText(GetNativeView(), window_title.c_str()); | 411 SetWindowText(GetNativeView(), window_title.c_str()); |
411 } | 412 } |
412 | 413 |
413 void WindowWin::UpdateWindowIcon() { | 414 void WindowWin::UpdateWindowIcon() { |
414 // If the non-client view is rendering its own icon, we need to tell it to | 415 // If the non-client view is rendering its own icon, we need to tell it to |
415 // repaint. | 416 // repaint. |
416 non_client_view_->SchedulePaint(); | 417 non_client_view_->SchedulePaint(); |
417 | 418 |
418 // Update the native frame's icon. We do this regardless of whether or not | 419 // Update the native frame's icon. We do this regardless of whether or not |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 is_right_mouse_pressed_on_caption_ = false; | 985 is_right_mouse_pressed_on_caption_ = false; |
985 ReleaseCapture(); | 986 ReleaseCapture(); |
986 // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu() | 987 // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu() |
987 // expect screen coordinates. | 988 // expect screen coordinates. |
988 CPoint screen_point(point); | 989 CPoint screen_point(point); |
989 MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_point, 1); | 990 MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_point, 1); |
990 ht_component = SendMessage(GetNativeView(), WM_NCHITTEST, 0, | 991 ht_component = SendMessage(GetNativeView(), WM_NCHITTEST, 0, |
991 MAKELPARAM(screen_point.x, screen_point.y)); | 992 MAKELPARAM(screen_point.x, screen_point.y)); |
992 if (ht_component == HTCAPTION || ht_component == HTSYSMENU) { | 993 if (ht_component == HTCAPTION || ht_component == HTSYSMENU) { |
993 UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD; | 994 UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD; |
994 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) | 995 if (base::i18n::IsRTL()) |
995 flags |= TPM_RIGHTALIGN; | 996 flags |= TPM_RIGHTALIGN; |
996 HMENU system_menu = GetSystemMenu(GetNativeView(), FALSE); | 997 HMENU system_menu = GetSystemMenu(GetNativeView(), FALSE); |
997 int id = TrackPopupMenu(system_menu, flags, screen_point.x, | 998 int id = TrackPopupMenu(system_menu, flags, screen_point.x, |
998 screen_point.y, 0, GetNativeView(), NULL); | 999 screen_point.y, 0, GetNativeView(), NULL); |
999 ExecuteSystemMenuCommand(id); | 1000 ExecuteSystemMenuCommand(id); |
1000 return; | 1001 return; |
1001 } | 1002 } |
1002 } | 1003 } |
1003 | 1004 |
1004 WidgetWin::OnRButtonUp(ht_component, point); | 1005 WidgetWin::OnRButtonUp(ht_component, point); |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 Window::CloseSecondaryWidget(root_view->GetWidget()); | 1430 Window::CloseSecondaryWidget(root_view->GetWidget()); |
1430 return TRUE; | 1431 return TRUE; |
1431 } | 1432 } |
1432 } // namespace | 1433 } // namespace |
1433 | 1434 |
1434 void Window::CloseAllSecondaryWindows() { | 1435 void Window::CloseAllSecondaryWindows() { |
1435 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); | 1436 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); |
1436 } | 1437 } |
1437 | 1438 |
1438 } // namespace views | 1439 } // namespace views |
OLD | NEW |