OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/button/menu_button.h" | 5 #include "views/controls/button/menu_button.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "grit/app_strings.h" | 8 #include "grit/app_strings.h" |
9 #include "grit/app_resources.h" | 9 #include "grit/app_resources.h" |
10 #include "ui/base/dragdrop/drag_drop_types.h" | 10 #include "ui/base/dragdrop/drag_drop_types.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // We can not use the views' mirroring infrastructure for mirroring a | 90 // We can not use the views' mirroring infrastructure for mirroring a |
91 // MenuButton control (see TextButton::Paint() for a detailed explanation | 91 // MenuButton control (see TextButton::Paint() for a detailed explanation |
92 // regarding why we can not flip the canvas). Therefore, we need to | 92 // regarding why we can not flip the canvas). Therefore, we need to |
93 // manually mirror the position of the down arrow. | 93 // manually mirror the position of the down arrow. |
94 gfx::Rect arrow_bounds(width() - insets.right() - | 94 gfx::Rect arrow_bounds(width() - insets.right() - |
95 menu_marker_->width() - kMenuMarkerPaddingRight, | 95 menu_marker_->width() - kMenuMarkerPaddingRight, |
96 height() / 2 - menu_marker_->height() / 2, | 96 height() / 2 - menu_marker_->height() / 2, |
97 menu_marker_->width(), | 97 menu_marker_->width(), |
98 menu_marker_->height()); | 98 menu_marker_->height()); |
99 arrow_bounds.set_x(MirroredLeftPointForRect(arrow_bounds)); | 99 arrow_bounds.set_x(GetMirroredXForRect(arrow_bounds)); |
100 canvas->DrawBitmapInt(*menu_marker_, arrow_bounds.x(), arrow_bounds.y()); | 100 canvas->DrawBitmapInt(*menu_marker_, arrow_bounds.x(), arrow_bounds.y()); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 //////////////////////////////////////////////////////////////////////////////// | 104 //////////////////////////////////////////////////////////////////////////////// |
105 // | 105 // |
106 // MenuButton - Events | 106 // MenuButton - Events |
107 // | 107 // |
108 //////////////////////////////////////////////////////////////////////////////// | 108 //////////////////////////////////////////////////////////////////////////////// |
109 | 109 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 266 |
267 AccessibilityTypes::State MenuButton::GetAccessibleState() { | 267 AccessibilityTypes::State MenuButton::GetAccessibleState() { |
268 return AccessibilityTypes::STATE_HASPOPUP; | 268 return AccessibilityTypes::STATE_HASPOPUP; |
269 } | 269 } |
270 | 270 |
271 std::string MenuButton::GetClassName() const { | 271 std::string MenuButton::GetClassName() const { |
272 return kViewClassName; | 272 return kViewClassName; |
273 } | 273 } |
274 | 274 |
275 } // namespace views | 275 } // namespace views |
OLD | NEW |