OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #include "app/gfx/native_theme_win.h" | 8 #include "app/gfx/native_theme_win.h" |
9 #include "app/gfx/path.h" | 9 #include "app/gfx/path.h" |
10 #include "app/l10n_util_win.h" | 10 #include "app/l10n_util_win.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 return; | 355 return; |
356 | 356 |
357 if (use_layered_buffer_) { | 357 if (use_layered_buffer_) { |
358 // Force creation of the buffer at the right size. | 358 // Force creation of the buffer at the right size. |
359 LayoutRootView(); | 359 LayoutRootView(); |
360 } else { | 360 } else { |
361 contents_.reset(NULL); | 361 contents_.reset(NULL); |
362 } | 362 } |
363 } | 363 } |
364 | 364 |
365 static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM l_param) { | |
366 RootView* root_view = | |
367 reinterpret_cast<RootView*>(GetProp(hwnd, kRootViewWindowProperty)); | |
368 if (root_view) { | |
369 *reinterpret_cast<RootView**>(l_param) = root_view; | |
370 return FALSE; // Stop enumerating. | |
371 } | |
372 return TRUE; // Keep enumerating. | |
373 } | |
374 | |
375 // static | |
376 RootView* WidgetWin::FindRootView(HWND hwnd) { | |
377 RootView* root_view = | |
378 reinterpret_cast<RootView*>(GetProp(hwnd, kRootViewWindowProperty)); | |
379 if (root_view) | |
380 return root_view; | |
381 | |
382 // Enumerate all children and check if they have a RootView. | |
383 EnumChildWindows(hwnd, EnumChildProc, reinterpret_cast<LPARAM>(&root_view)); | |
384 | |
385 return root_view; | |
386 } | |
387 | |
388 // static | 365 // static |
389 WidgetWin* WidgetWin::GetWidget(HWND hwnd) { | 366 WidgetWin* WidgetWin::GetWidget(HWND hwnd) { |
390 return reinterpret_cast<WidgetWin*>(win_util::GetWindowUserData(hwnd)); | 367 return reinterpret_cast<WidgetWin*>(win_util::GetWindowUserData(hwnd)); |
391 } | 368 } |
392 | 369 |
393 //////////////////////////////////////////////////////////////////////////////// | 370 //////////////////////////////////////////////////////////////////////////////// |
394 // MessageLoop::Observer | 371 // MessageLoop::Observer |
395 | 372 |
396 void WidgetWin::WillProcessMessage(const MSG& msg) { | 373 void WidgetWin::WillProcessMessage(const MSG& msg) { |
397 } | 374 } |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 if (transparent == Transparent) | 1154 if (transparent == Transparent) |
1178 ex_style |= WS_EX_LAYERED; | 1155 ex_style |= WS_EX_LAYERED; |
1179 if (accept_events != AcceptEvents) | 1156 if (accept_events != AcceptEvents) |
1180 ex_style |= WS_EX_TRANSPARENT; | 1157 ex_style |= WS_EX_TRANSPARENT; |
1181 popup->set_window_style(WS_POPUP); | 1158 popup->set_window_style(WS_POPUP); |
1182 popup->set_window_ex_style(ex_style); | 1159 popup->set_window_ex_style(ex_style); |
1183 popup->set_delete_on_destroy(delete_on_destroy == DeleteOnDestroy); | 1160 popup->set_delete_on_destroy(delete_on_destroy == DeleteOnDestroy); |
1184 return popup; | 1161 return popup; |
1185 } | 1162 } |
1186 | 1163 |
| 1164 static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM l_param) { |
| 1165 RootView* root_view = |
| 1166 reinterpret_cast<RootView*>(GetProp(hwnd, kRootViewWindowProperty)); |
| 1167 if (root_view) { |
| 1168 *reinterpret_cast<RootView**>(l_param) = root_view; |
| 1169 return FALSE; // Stop enumerating. |
| 1170 } |
| 1171 return TRUE; // Keep enumerating. |
| 1172 } |
| 1173 |
| 1174 // static |
| 1175 RootView* Widget::FindRootView(HWND hwnd) { |
| 1176 RootView* root_view = |
| 1177 reinterpret_cast<RootView*>(GetProp(hwnd, kRootViewWindowProperty)); |
| 1178 if (root_view) |
| 1179 return root_view; |
| 1180 |
| 1181 // Enumerate all children and check if they have a RootView. |
| 1182 EnumChildWindows(hwnd, EnumChildProc, reinterpret_cast<LPARAM>(&root_view)); |
| 1183 |
| 1184 return root_view; |
| 1185 } |
| 1186 |
1187 } // namespace views | 1187 } // namespace views |
OLD | NEW |