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/widget_hwnd_utils.h" | 5 #include "ui/views/widget/widget_hwnd_utils.h" |
6 | 6 |
7 #include "base/win/windows_version.h" | 7 #include "base/win/windows_version.h" |
8 #include "ui/base/l10n/l10n_util_win.h" | 8 #include "ui/base/l10n/l10n_util_win.h" |
9 #include "ui/views/widget/widget_delegate.h" | 9 #include "ui/views/widget/widget_delegate.h" |
10 #include "ui/views/win/hwnd_message_handler.h" | 10 #include "ui/views/win/hwnd_message_handler.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 switch (params.type) { | 53 switch (params.type) { |
54 case Widget::InitParams::TYPE_PANEL: | 54 case Widget::InitParams::TYPE_PANEL: |
55 *ex_style |= WS_EX_TOPMOST; | 55 *ex_style |= WS_EX_TOPMOST; |
56 // No break. Fall through to TYPE_WINDOW. | 56 // No break. Fall through to TYPE_WINDOW. |
57 case Widget::InitParams::TYPE_WINDOW: { | 57 case Widget::InitParams::TYPE_WINDOW: { |
58 *style |= WS_SYSMENU | WS_CAPTION; | 58 *style |= WS_SYSMENU | WS_CAPTION; |
59 bool can_resize = widget_delegate->CanResize(); | 59 bool can_resize = widget_delegate->CanResize(); |
60 bool can_maximize = widget_delegate->CanMaximize(); | 60 bool can_maximize = widget_delegate->CanMaximize(); |
61 if (can_maximize) { | 61 if (can_maximize) { |
62 *style |= WS_OVERLAPPEDWINDOW; | 62 *style |= WS_OVERLAPPEDWINDOW; |
63 } else if (can_resize) { | 63 } else if (can_resize || params.remove_standard_frame) { |
64 *style |= WS_OVERLAPPED | WS_THICKFRAME; | 64 *style |= WS_OVERLAPPED | WS_THICKFRAME; |
65 } | 65 } |
66 if (native_widget_delegate->IsDialogBox()) { | 66 if (native_widget_delegate->IsDialogBox()) { |
67 *style |= DS_MODALFRAME; | 67 *style |= DS_MODALFRAME; |
68 // NOTE: Turning this off means we lose the close button, which is bad. | 68 // NOTE: Turning this off means we lose the close button, which is bad. |
69 // Turning it on though means the user can maximize or size the window | 69 // Turning it on though means the user can maximize or size the window |
70 // from the system menu, which is worse. We may need to provide our own | 70 // from the system menu, which is worse. We may need to provide our own |
71 // menu to get the close button to appear properly. | 71 // menu to get the close button to appear properly. |
72 // style &= ~WS_SYSMENU; | 72 // style &= ~WS_SYSMENU; |
73 | 73 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 DWORD class_style = 0; | 120 DWORD class_style = 0; |
121 CalculateWindowStylesFromInitParams(params, widget_delegate, | 121 CalculateWindowStylesFromInitParams(params, widget_delegate, |
122 native_widget_delegate, &style, &ex_style, | 122 native_widget_delegate, &style, &ex_style, |
123 &class_style); | 123 &class_style); |
124 handler->set_initial_class_style(class_style); | 124 handler->set_initial_class_style(class_style); |
125 handler->set_window_style(handler->window_style() | style); | 125 handler->set_window_style(handler->window_style() | style); |
126 handler->set_window_ex_style(handler->window_ex_style() | ex_style); | 126 handler->set_window_ex_style(handler->window_ex_style() | ex_style); |
127 } | 127 } |
128 | 128 |
129 } // namespace views | 129 } // namespace views |
OLD | NEW |