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 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 WidgetWin* popup = new WidgetWin; | 1201 WidgetWin* popup = new WidgetWin; |
1202 popup->SetCreateParams(params); | 1202 popup->SetCreateParams(params); |
1203 return popup; | 1203 return popup; |
1204 } | 1204 } |
1205 | 1205 |
1206 // static | 1206 // static |
1207 void Widget::NotifyLocaleChanged() { | 1207 void Widget::NotifyLocaleChanged() { |
1208 NOTIMPLEMENTED(); | 1208 NOTIMPLEMENTED(); |
1209 } | 1209 } |
1210 | 1210 |
| 1211 bool Widget::ConvertRect(const Widget* source, |
| 1212 const Widget* target, |
| 1213 gfx::Rect* rect) { |
| 1214 DCHECK(source); |
| 1215 DCHECK(target); |
| 1216 DCHECK(rect); |
| 1217 |
| 1218 HWND source_hwnd = source->GetNativeView(); |
| 1219 HWND target_hwnd = target->GetNativeView(); |
| 1220 if (source_hwnd == target_hwnd) |
| 1221 return true; |
| 1222 |
| 1223 RECT win_rect = rect->ToRECT(); |
| 1224 if (::MapWindowPoints(source_hwnd, target_hwnd, |
| 1225 reinterpret_cast<LPPOINT>(&win_rect), |
| 1226 sizeof(RECT)/sizeof(POINT))) { |
| 1227 *rect = win_rect; |
| 1228 return true; |
| 1229 } |
| 1230 return false; |
| 1231 } |
| 1232 |
1211 //////////////////////////////////////////////////////////////////////////////// | 1233 //////////////////////////////////////////////////////////////////////////////// |
1212 // NativeWidget, public: | 1234 // NativeWidget, public: |
1213 | 1235 |
1214 NativeWidget* NativeWidget::GetNativeWidgetForNativeView( | 1236 NativeWidget* NativeWidget::GetNativeWidgetForNativeView( |
1215 gfx::NativeView native_view) { | 1237 gfx::NativeView native_view) { |
1216 if (!ui::WindowImpl::IsWindowImpl(native_view)) | 1238 if (!ui::WindowImpl::IsWindowImpl(native_view)) |
1217 return NULL; | 1239 return NULL; |
1218 return reinterpret_cast<WidgetWin*>( | 1240 return reinterpret_cast<WidgetWin*>( |
1219 ViewProp::GetValue(native_view, kNativeWidgetKey)); | 1241 ViewProp::GetValue(native_view, kNativeWidgetKey)); |
1220 } | 1242 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 return; | 1280 return; |
1259 | 1281 |
1260 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); | 1282 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); |
1261 if (native_widget) | 1283 if (native_widget) |
1262 children->insert(native_widget); | 1284 children->insert(native_widget); |
1263 EnumChildWindows(native_view, EnumerateChildWindowsForNativeWidgets, | 1285 EnumChildWindows(native_view, EnumerateChildWindowsForNativeWidgets, |
1264 reinterpret_cast<LPARAM>(children)); | 1286 reinterpret_cast<LPARAM>(children)); |
1265 } | 1287 } |
1266 | 1288 |
1267 } // namespace views | 1289 } // namespace views |
OLD | NEW |