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 #include "ui/views/win/hwnd_message_handler.h" | 5 #include "ui/views/win/hwnd_message_handler.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <oleacc.h> | 8 #include <oleacc.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <wtsapi32.h> | 10 #include <wtsapi32.h> |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 bool is_maximized = IsMaximized(); | 1486 bool is_maximized = IsMaximized(); |
1487 bool is_restored = !is_fullscreen && !is_minimized && !is_maximized; | 1487 bool is_restored = !is_fullscreen && !is_minimized && !is_maximized; |
1488 | 1488 |
1489 ScopedRedrawLock lock(this); | 1489 ScopedRedrawLock lock(this); |
1490 EnableMenuItemByCommand(menu, SC_RESTORE, delegate_->CanResize() && | 1490 EnableMenuItemByCommand(menu, SC_RESTORE, delegate_->CanResize() && |
1491 (is_minimized || is_maximized)); | 1491 (is_minimized || is_maximized)); |
1492 EnableMenuItemByCommand(menu, SC_MOVE, is_restored); | 1492 EnableMenuItemByCommand(menu, SC_MOVE, is_restored); |
1493 EnableMenuItemByCommand(menu, SC_SIZE, delegate_->CanResize() && is_restored); | 1493 EnableMenuItemByCommand(menu, SC_SIZE, delegate_->CanResize() && is_restored); |
1494 EnableMenuItemByCommand(menu, SC_MAXIMIZE, delegate_->CanMaximize() && | 1494 EnableMenuItemByCommand(menu, SC_MAXIMIZE, delegate_->CanMaximize() && |
1495 !is_fullscreen && !is_maximized); | 1495 !is_fullscreen && !is_maximized); |
1496 // TODO: unfortunately, WidgetDelegate does not declare CanMinimize() and some | 1496 EnableMenuItemByCommand(menu, SC_MINIMIZE, delegate_->CanMinimize() && |
1497 // code depends on this check, see http://crbug.com/341010. | |
1498 EnableMenuItemByCommand(menu, SC_MINIMIZE, delegate_->CanMaximize() && | |
1499 !is_minimized); | 1497 !is_minimized); |
1500 | 1498 |
1501 if (is_maximized && delegate_->CanResize()) | 1499 if (is_maximized && delegate_->CanResize()) |
1502 ::SetMenuDefaultItem(menu, SC_RESTORE, FALSE); | 1500 ::SetMenuDefaultItem(menu, SC_RESTORE, FALSE); |
1503 else if (!is_maximized && delegate_->CanMaximize()) | 1501 else if (!is_maximized && delegate_->CanMaximize()) |
1504 ::SetMenuDefaultItem(menu, SC_MAXIMIZE, FALSE); | 1502 ::SetMenuDefaultItem(menu, SC_MAXIMIZE, FALSE); |
1505 } | 1503 } |
1506 | 1504 |
1507 void HWNDMessageHandler::OnInputLangChange(DWORD character_set, | 1505 void HWNDMessageHandler::OnInputLangChange(DWORD character_set, |
1508 HKL input_language_id) { | 1506 HKL input_language_id) { |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2483 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); | 2481 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); |
2484 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); | 2482 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); |
2485 } | 2483 } |
2486 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want | 2484 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want |
2487 // to notify our children too, since we can have MDI child windows who need to | 2485 // to notify our children too, since we can have MDI child windows who need to |
2488 // update their appearance. | 2486 // update their appearance. |
2489 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); | 2487 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); |
2490 } | 2488 } |
2491 | 2489 |
2492 } // namespace views | 2490 } // namespace views |
OLD | NEW |