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/widget/native_widget_win.h" | 5 #include "ui/views/widget/native_widget_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 | 1378 |
1379 // Return with failure. | 1379 // Return with failure. |
1380 return static_cast<LRESULT>(0L); | 1380 return static_cast<LRESULT>(0L); |
1381 } | 1381 } |
1382 | 1382 |
1383 return reference_result; | 1383 return reference_result; |
1384 } | 1384 } |
1385 | 1385 |
1386 void NativeWidgetWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) { | 1386 void NativeWidgetWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) { |
1387 gfx::Size min_window_size(delegate_->GetMinimumSize()); | 1387 gfx::Size min_window_size(delegate_->GetMinimumSize()); |
1388 // Add the native frame border size to the minimum size if the view reports | 1388 gfx::Size max_window_size(delegate_->GetMaximumSize()); |
1389 // its size as the client size. | 1389 // Add the native frame border size to the minimum and maximum size if the |
| 1390 // view reports its size as the client size. |
1390 if (WidgetSizeIsClientSize()) { | 1391 if (WidgetSizeIsClientSize()) { |
1391 CRect client_rect, window_rect; | 1392 CRect client_rect, window_rect; |
1392 GetClientRect(&client_rect); | 1393 GetClientRect(&client_rect); |
1393 GetWindowRect(&window_rect); | 1394 GetWindowRect(&window_rect); |
1394 window_rect -= client_rect; | 1395 window_rect -= client_rect; |
1395 min_window_size.Enlarge(window_rect.Width(), window_rect.Height()); | 1396 min_window_size.Enlarge(window_rect.Width(), window_rect.Height()); |
| 1397 if (!max_window_size.IsEmpty()) |
| 1398 max_window_size.Enlarge(window_rect.Width(), window_rect.Height()); |
1396 } | 1399 } |
1397 minmax_info->ptMinTrackSize.x = min_window_size.width(); | 1400 minmax_info->ptMinTrackSize.x = min_window_size.width(); |
1398 minmax_info->ptMinTrackSize.y = min_window_size.height(); | 1401 minmax_info->ptMinTrackSize.y = min_window_size.height(); |
| 1402 if (!max_window_size.IsEmpty()) { |
| 1403 minmax_info->ptMaxTrackSize.x = max_window_size.width(); |
| 1404 minmax_info->ptMaxTrackSize.y = max_window_size.height(); |
| 1405 } |
1399 SetMsgHandled(FALSE); | 1406 SetMsgHandled(FALSE); |
1400 } | 1407 } |
1401 | 1408 |
1402 void NativeWidgetWin::OnHScroll(int scroll_type, | 1409 void NativeWidgetWin::OnHScroll(int scroll_type, |
1403 short position, | 1410 short position, |
1404 HWND scrollbar) { | 1411 HWND scrollbar) { |
1405 SetMsgHandled(FALSE); | 1412 SetMsgHandled(FALSE); |
1406 } | 1413 } |
1407 | 1414 |
1408 LRESULT NativeWidgetWin::OnImeMessages(UINT message, | 1415 LRESULT NativeWidgetWin::OnImeMessages(UINT message, |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2616 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2623 return (GetKeyState(VK_LBUTTON) & 0x80) || |
2617 (GetKeyState(VK_RBUTTON) & 0x80) || | 2624 (GetKeyState(VK_RBUTTON) & 0x80) || |
2618 (GetKeyState(VK_MBUTTON) & 0x80) || | 2625 (GetKeyState(VK_MBUTTON) & 0x80) || |
2619 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2626 (GetKeyState(VK_XBUTTON1) & 0x80) || |
2620 (GetKeyState(VK_XBUTTON2) & 0x80); | 2627 (GetKeyState(VK_XBUTTON2) & 0x80); |
2621 } | 2628 } |
2622 | 2629 |
2623 } // namespace internal | 2630 } // namespace internal |
2624 | 2631 |
2625 } // namespace views | 2632 } // namespace views |
OLD | NEW |