| 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/button/menu_button.h" | 5 #include "views/controls/button/menu_button.h" |
| 6 | 6 |
| 7 #include "app/drag_drop_types.h" | 7 #include "app/drag_drop_types.h" |
| 8 #include "app/gfx/chrome_canvas.h" | 8 #include "app/gfx/canvas.h" |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "app/win_util.h" | 11 #include "app/win_util.h" |
| 12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
| 14 #include "views/controls/button/button.h" | 14 #include "views/controls/button/button.h" |
| 15 #include "views/controls/menu/view_menu_delegate.h" | 15 #include "views/controls/menu/view_menu_delegate.h" |
| 16 #include "views/event.h" | 16 #include "views/event.h" |
| 17 #include "views/widget/root_view.h" | 17 #include "views/widget/root_view.h" |
| 18 #include "views/widget/widget.h" | 18 #include "views/widget/widget.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 gfx::Size MenuButton::GetPreferredSize() { | 68 gfx::Size MenuButton::GetPreferredSize() { |
| 69 gfx::Size prefsize = TextButton::GetPreferredSize(); | 69 gfx::Size prefsize = TextButton::GetPreferredSize(); |
| 70 if (show_menu_marker_) { | 70 if (show_menu_marker_) { |
| 71 prefsize.Enlarge(kMenuMarker->width() + kMenuMarkerPaddingLeft + | 71 prefsize.Enlarge(kMenuMarker->width() + kMenuMarkerPaddingLeft + |
| 72 kMenuMarkerPaddingRight, | 72 kMenuMarkerPaddingRight, |
| 73 0); | 73 0); |
| 74 } | 74 } |
| 75 return prefsize; | 75 return prefsize; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void MenuButton::Paint(ChromeCanvas* canvas, bool for_drag) { | 78 void MenuButton::Paint(gfx::Canvas* canvas, bool for_drag) { |
| 79 TextButton::Paint(canvas, for_drag); | 79 TextButton::Paint(canvas, for_drag); |
| 80 | 80 |
| 81 if (show_menu_marker_) { | 81 if (show_menu_marker_) { |
| 82 gfx::Insets insets = GetInsets(); | 82 gfx::Insets insets = GetInsets(); |
| 83 | 83 |
| 84 // We can not use the views' mirroring infrastructure for mirroring a | 84 // We can not use the views' mirroring infrastructure for mirroring a |
| 85 // MenuButton control (see TextButton::Paint() for a detailed explanation | 85 // MenuButton control (see TextButton::Paint() for a detailed explanation |
| 86 // regarding why we can not flip the canvas). Therefore, we need to | 86 // regarding why we can not flip the canvas). Therefore, we need to |
| 87 // manually mirror the position of the down arrow. | 87 // manually mirror the position of the down arrow. |
| 88 gfx::Rect arrow_bounds(width() - insets.right() - | 88 gfx::Rect arrow_bounds(width() - insets.right() - |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 } | 243 } |
| 244 | 244 |
| 245 bool MenuButton::GetAccessibleState(AccessibilityTypes::State* state) { | 245 bool MenuButton::GetAccessibleState(AccessibilityTypes::State* state) { |
| 246 DCHECK(state); | 246 DCHECK(state); |
| 247 | 247 |
| 248 *state = AccessibilityTypes::STATE_HASPOPUP; | 248 *state = AccessibilityTypes::STATE_HASPOPUP; |
| 249 return true; | 249 return true; |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace views | 252 } // namespace views |
| OLD | NEW |