Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 583603004: Add CanMinimize to classes that implement WidgetDelegate::CanMaximize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@win_resizable
Patch Set: Add TODO. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/widget/widget_delegate.h ('k') | ui/views/win/hwnd_message_handler_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 bool is_maximized = IsMaximized(); 1469 bool is_maximized = IsMaximized();
1470 bool is_restored = !is_fullscreen && !is_minimized && !is_maximized; 1470 bool is_restored = !is_fullscreen && !is_minimized && !is_maximized;
1471 1471
1472 ScopedRedrawLock lock(this); 1472 ScopedRedrawLock lock(this);
1473 EnableMenuItemByCommand(menu, SC_RESTORE, delegate_->CanResize() && 1473 EnableMenuItemByCommand(menu, SC_RESTORE, delegate_->CanResize() &&
1474 (is_minimized || is_maximized)); 1474 (is_minimized || is_maximized));
1475 EnableMenuItemByCommand(menu, SC_MOVE, is_restored); 1475 EnableMenuItemByCommand(menu, SC_MOVE, is_restored);
1476 EnableMenuItemByCommand(menu, SC_SIZE, delegate_->CanResize() && is_restored); 1476 EnableMenuItemByCommand(menu, SC_SIZE, delegate_->CanResize() && is_restored);
1477 EnableMenuItemByCommand(menu, SC_MAXIMIZE, delegate_->CanMaximize() && 1477 EnableMenuItemByCommand(menu, SC_MAXIMIZE, delegate_->CanMaximize() &&
1478 !is_fullscreen && !is_maximized); 1478 !is_fullscreen && !is_maximized);
1479 // TODO: unfortunately, WidgetDelegate does not declare CanMinimize() and some 1479 EnableMenuItemByCommand(menu, SC_MINIMIZE, delegate_->CanMinimize() &&
1480 // code depends on this check, see http://crbug.com/341010.
1481 EnableMenuItemByCommand(menu, SC_MINIMIZE, delegate_->CanMaximize() &&
1482 !is_minimized); 1480 !is_minimized);
1483 1481
1484 if (is_maximized && delegate_->CanResize()) 1482 if (is_maximized && delegate_->CanResize())
1485 ::SetMenuDefaultItem(menu, SC_RESTORE, FALSE); 1483 ::SetMenuDefaultItem(menu, SC_RESTORE, FALSE);
1486 else if (!is_maximized && delegate_->CanMaximize()) 1484 else if (!is_maximized && delegate_->CanMaximize())
1487 ::SetMenuDefaultItem(menu, SC_MAXIMIZE, FALSE); 1485 ::SetMenuDefaultItem(menu, SC_MAXIMIZE, FALSE);
1488 } 1486 }
1489 1487
1490 void HWNDMessageHandler::OnInputLangChange(DWORD character_set, 1488 void HWNDMessageHandler::OnInputLangChange(DWORD character_set,
1491 HKL input_language_id) { 1489 HKL input_language_id) {
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
2466 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); 2464 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW);
2467 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); 2465 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW);
2468 } 2466 }
2469 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want 2467 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want
2470 // to notify our children too, since we can have MDI child windows who need to 2468 // to notify our children too, since we can have MDI child windows who need to
2471 // update their appearance. 2469 // update their appearance.
2472 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); 2470 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL);
2473 } 2471 }
2474 2472
2475 } // namespace views 2473 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/widget_delegate.h ('k') | ui/views/win/hwnd_message_handler_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698