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/widget_win.h" | 5 #include "views/widget/widget_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 WidgetWin* popup = new WidgetWin; | 1205 WidgetWin* popup = new WidgetWin; |
1206 popup->SetCreateParams(params); | 1206 popup->SetCreateParams(params); |
1207 return popup; | 1207 return popup; |
1208 } | 1208 } |
1209 | 1209 |
1210 // static | 1210 // static |
1211 void Widget::NotifyLocaleChanged() { | 1211 void Widget::NotifyLocaleChanged() { |
1212 NOTIMPLEMENTED(); | 1212 NOTIMPLEMENTED(); |
1213 } | 1213 } |
1214 | 1214 |
| 1215 bool Widget::ConvertRect(const Widget* source, |
| 1216 const Widget* target, |
| 1217 gfx::Rect* rect) { |
| 1218 DCHECK(source); |
| 1219 DCHECK(target); |
| 1220 DCHECK(rect); |
| 1221 |
| 1222 HWND source_hwnd = source->GetNativeView(); |
| 1223 HWND target_hwnd = target->GetNativeView(); |
| 1224 if (source_hwnd == target_hwnd) |
| 1225 return true; |
| 1226 |
| 1227 RECT win_rect = rect->ToRECT(); |
| 1228 if (::MapWindowPoints(source_hwnd, target_hwnd, |
| 1229 reinterpret_cast<LPPOINT>(&win_rect), |
| 1230 sizeof(RECT)/sizeof(POINT))) { |
| 1231 *rect = win_rect; |
| 1232 return true; |
| 1233 } |
| 1234 return false; |
| 1235 } |
| 1236 |
1215 //////////////////////////////////////////////////////////////////////////////// | 1237 //////////////////////////////////////////////////////////////////////////////// |
1216 // NativeWidget, public: | 1238 // NativeWidget, public: |
1217 | 1239 |
1218 NativeWidget* NativeWidget::GetNativeWidgetForNativeView( | 1240 NativeWidget* NativeWidget::GetNativeWidgetForNativeView( |
1219 gfx::NativeView native_view) { | 1241 gfx::NativeView native_view) { |
1220 if (!ui::WindowImpl::IsWindowImpl(native_view)) | 1242 if (!ui::WindowImpl::IsWindowImpl(native_view)) |
1221 return NULL; | 1243 return NULL; |
1222 return reinterpret_cast<WidgetWin*>( | 1244 return reinterpret_cast<WidgetWin*>( |
1223 ViewProp::GetValue(native_view, kNativeWidgetKey)); | 1245 ViewProp::GetValue(native_view, kNativeWidgetKey)); |
1224 } | 1246 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 return; | 1284 return; |
1263 | 1285 |
1264 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); | 1286 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); |
1265 if (native_widget) | 1287 if (native_widget) |
1266 children->insert(native_widget); | 1288 children->insert(native_widget); |
1267 EnumChildWindows(native_view, EnumerateChildWindowsForNativeWidgets, | 1289 EnumChildWindows(native_view, EnumerateChildWindowsForNativeWidgets, |
1268 reinterpret_cast<LPARAM>(children)); | 1290 reinterpret_cast<LPARAM>(children)); |
1269 } | 1291 } |
1270 | 1292 |
1271 } // namespace views | 1293 } // namespace views |
OLD | NEW |