Chromium Code Reviews| 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/native_widget_win.h" | 5 #include "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 "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 // NOTE: Be careful not to activate any windows here (for example, calling | 875 // NOTE: Be careful not to activate any windows here (for example, calling |
| 876 // ShowWindow(SW_HIDE) will automatically activate another window). This | 876 // ShowWindow(SW_HIDE) will automatically activate another window). This |
| 877 // code can be called while a window is being deactivated, and activating | 877 // code can be called while a window is being deactivated, and activating |
| 878 // another window will screw up the activation that is already in progress. | 878 // another window will screw up the activation that is already in progress. |
| 879 SetWindowPos(NULL, 0, 0, 0, 0, | 879 SetWindowPos(NULL, 0, 0, 0, 0, |
| 880 SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | | 880 SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | |
| 881 SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER); | 881 SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER); |
| 882 } | 882 } |
| 883 } | 883 } |
| 884 | 884 |
| 885 void NativeWidgetWin::ShowMaximized(const gfx::Rect& restored_bounds) { | |
| 886 WINDOWPLACEMENT placement = { 0 }; | |
| 887 placement.length = sizeof(WINDOWPLACEMENT); | |
| 888 placement.showCmd = SW_SHOWMAXIMIZED; | |
| 889 placement.rcNormalPosition = restored_bounds.ToRECT(); | |
| 890 SetWindowPlacement(hwnd(), &placement); | |
| 891 } | |
| 892 | |
| 885 void NativeWidgetWin::ShowNativeWidget(ShowState state) { | 893 void NativeWidgetWin::ShowNativeWidget(ShowState state) { |
|
Ben Goodger (Google)
2011/07/13 23:53:40
OK let's normalize these names.
Show()->Show()
Sh
| |
| 886 DWORD native_show_state; | 894 DWORD native_show_state; |
| 887 switch (state) { | 895 switch (state) { |
| 888 case SHOW_INACTIVE: | 896 case SHOW_INACTIVE: |
| 889 native_show_state = SW_SHOWNOACTIVATE; | 897 native_show_state = SW_SHOWNOACTIVATE; |
| 890 break; | 898 break; |
| 891 case SHOW_MAXIMIZED: | 899 case SHOW_MAXIMIZED: |
| 892 native_show_state = SW_SHOWMAXIMIZED; | 900 native_show_state = SW_SHOWMAXIMIZED; |
| 893 break; | 901 break; |
| 894 default: | 902 default: |
| 895 native_show_state = GetShowState(); | 903 native_show_state = GetShowState(); |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2180 // Set non-style attributes. | 2188 // Set non-style attributes. |
| 2181 ownership_ = params.ownership; | 2189 ownership_ = params.ownership; |
| 2182 | 2190 |
| 2183 DWORD style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS; | 2191 DWORD style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS; |
| 2184 DWORD ex_style = 0; | 2192 DWORD ex_style = 0; |
| 2185 DWORD class_style = CS_DBLCLKS; | 2193 DWORD class_style = CS_DBLCLKS; |
| 2186 | 2194 |
| 2187 // Set type-independent style attributes. | 2195 // Set type-independent style attributes. |
| 2188 if (params.child) | 2196 if (params.child) |
| 2189 style |= WS_CHILD | WS_VISIBLE; | 2197 style |= WS_CHILD | WS_VISIBLE; |
| 2198 if (params.maximize) | |
| 2199 style |= WS_MAXIMIZE; | |
| 2190 if (!params.accept_events) | 2200 if (!params.accept_events) |
| 2191 ex_style |= WS_EX_TRANSPARENT; | 2201 ex_style |= WS_EX_TRANSPARENT; |
| 2192 if (!params.can_activate) | 2202 if (!params.can_activate) |
| 2193 ex_style |= WS_EX_NOACTIVATE; | 2203 ex_style |= WS_EX_NOACTIVATE; |
| 2194 if (params.keep_on_top) | 2204 if (params.keep_on_top) |
| 2195 ex_style |= WS_EX_TOPMOST; | 2205 ex_style |= WS_EX_TOPMOST; |
| 2196 if (params.mirror_origin_in_rtl) | 2206 if (params.mirror_origin_in_rtl) |
| 2197 ex_style |= l10n_util::GetExtendedTooltipStyles(); | 2207 ex_style |= l10n_util::GetExtendedTooltipStyles(); |
| 2198 if (params.transparent) | 2208 if (params.transparent) |
| 2199 ex_style |= WS_EX_LAYERED; | 2209 ex_style |= WS_EX_LAYERED; |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2528 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2538 return (GetKeyState(VK_LBUTTON) & 0x80) || |
| 2529 (GetKeyState(VK_RBUTTON) & 0x80) || | 2539 (GetKeyState(VK_RBUTTON) & 0x80) || |
| 2530 (GetKeyState(VK_MBUTTON) & 0x80) || | 2540 (GetKeyState(VK_MBUTTON) & 0x80) || |
| 2531 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2541 (GetKeyState(VK_XBUTTON1) & 0x80) || |
| 2532 (GetKeyState(VK_XBUTTON2) & 0x80); | 2542 (GetKeyState(VK_XBUTTON2) & 0x80); |
| 2533 } | 2543 } |
| 2534 | 2544 |
| 2535 } // namespace internal | 2545 } // namespace internal |
| 2536 | 2546 |
| 2537 } // namespace views | 2547 } // namespace views |
| OLD | NEW |