| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/controls/tree/tree_view.h" | 5 #include "views/controls/tree/tree_view.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlapp.h> | 8 #include <atlapp.h> |
| 9 #include <atlmisc.h> | 9 #include <atlmisc.h> |
| 10 | 10 |
| 11 #include "app/gfx/chrome_canvas.h" | 11 #include "app/gfx/canvas.h" |
| 12 #include "app/gfx/icon_util.h" | 12 #include "app/gfx/icon_util.h" |
| 13 #include "app/l10n_util.h" | 13 #include "app/l10n_util.h" |
| 14 #include "app/l10n_util_win.h" | 14 #include "app/l10n_util_win.h" |
| 15 #include "app/resource_bundle.h" | 15 #include "app/resource_bundle.h" |
| 16 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
| 17 #include "base/win_util.h" | 17 #include "base/win_util.h" |
| 18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 19 #include "views/focus/focus_manager.h" | 19 #include "views/focus/focus_manager.h" |
| 20 #include "views/widget/widget.h" | 20 #include "views/widget/widget.h" |
| 21 | 21 |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 | 677 |
| 678 // We handle the messages WM_ERASEBKGND and WM_PAINT such that we paint into | 678 // We handle the messages WM_ERASEBKGND and WM_PAINT such that we paint into |
| 679 // a DIB first and then perform a BitBlt from the DIB into the underlying | 679 // a DIB first and then perform a BitBlt from the DIB into the underlying |
| 680 // window's DC. This double buffering code prevents the tree view from | 680 // window's DC. This double buffering code prevents the tree view from |
| 681 // flickering during resize. | 681 // flickering during resize. |
| 682 switch (message) { | 682 switch (message) { |
| 683 case WM_ERASEBKGND: | 683 case WM_ERASEBKGND: |
| 684 return 1; | 684 return 1; |
| 685 | 685 |
| 686 case WM_PAINT: { | 686 case WM_PAINT: { |
| 687 ChromeCanvasPaint canvas(window); | 687 gfx::CanvasPaint canvas(window); |
| 688 if (canvas.isEmpty()) | 688 if (canvas.isEmpty()) |
| 689 return 0; | 689 return 0; |
| 690 | 690 |
| 691 HDC dc = canvas.beginPlatformPaint(); | 691 HDC dc = canvas.beginPlatformPaint(); |
| 692 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { | 692 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { |
| 693 // ChromeCanvas ends up configuring the DC with a mode of GM_ADVANCED. | 693 // gfx::Canvas ends up configuring the DC with a mode of GM_ADVANCED. |
| 694 // For some reason a graphics mode of ADVANCED triggers all the text | 694 // For some reason a graphics mode of ADVANCED triggers all the text |
| 695 // to be mirrored when RTL. Set the mode back to COMPATIBLE and | 695 // to be mirrored when RTL. Set the mode back to COMPATIBLE and |
| 696 // explicitly set the layout. Additionally SetWorldTransform and | 696 // explicitly set the layout. Additionally SetWorldTransform and |
| 697 // COMPATIBLE don't play nicely together. We need to use | 697 // COMPATIBLE don't play nicely together. We need to use |
| 698 // SetViewportOrgEx when using a mode of COMPATIBLE. | 698 // SetViewportOrgEx when using a mode of COMPATIBLE. |
| 699 // | 699 // |
| 700 // Reset the transform to the identify transform. Even though | 700 // Reset the transform to the identify transform. Even though |
| 701 // SetWorldTransform and COMPATIBLE don't play nicely, bits of the | 701 // SetWorldTransform and COMPATIBLE don't play nicely, bits of the |
| 702 // transform still carry over when we set the mode. | 702 // transform still carry over when we set the mode. |
| 703 XFORM xform = {0}; | 703 XFORM xform = {0}; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 } | 738 } |
| 739 // Fall through and let the default handler process as well. | 739 // Fall through and let the default handler process as well. |
| 740 break; | 740 break; |
| 741 } | 741 } |
| 742 WNDPROC handler = tree->original_handler_; | 742 WNDPROC handler = tree->original_handler_; |
| 743 DCHECK(handler); | 743 DCHECK(handler); |
| 744 return CallWindowProc(handler, window, message, w_param, l_param); | 744 return CallWindowProc(handler, window, message, w_param, l_param); |
| 745 } | 745 } |
| 746 | 746 |
| 747 } // namespace views | 747 } // namespace views |
| OLD | NEW |