Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/menu/menu_item_view.h" | 5 #include "ui/views/controls/menu/menu_item_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "ui/strings/grit/ui_strings.h" | 25 #include "ui/strings/grit/ui_strings.h" |
| 26 #include "ui/views/controls/button/menu_button.h" | 26 #include "ui/views/controls/button/menu_button.h" |
| 27 #include "ui/views/controls/image_view.h" | 27 #include "ui/views/controls/image_view.h" |
| 28 #include "ui/views/controls/menu/menu_config.h" | 28 #include "ui/views/controls/menu/menu_config.h" |
| 29 #include "ui/views/controls/menu/menu_controller.h" | 29 #include "ui/views/controls/menu/menu_controller.h" |
| 30 #include "ui/views/controls/menu/menu_image_util.h" | 30 #include "ui/views/controls/menu/menu_image_util.h" |
| 31 #include "ui/views/controls/menu/menu_scroll_view_container.h" | 31 #include "ui/views/controls/menu/menu_scroll_view_container.h" |
| 32 #include "ui/views/controls/menu/menu_separator.h" | 32 #include "ui/views/controls/menu/menu_separator.h" |
| 33 #include "ui/views/controls/menu/submenu_view.h" | 33 #include "ui/views/controls/menu/submenu_view.h" |
| 34 #include "ui/views/resources/grit/views_resources.h" | 34 #include "ui/views/resources/grit/views_resources.h" |
| 35 #include "ui/views/round_rect_painter.h" | |
| 35 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 36 | 37 |
| 37 namespace views { | 38 namespace views { |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 // EmptyMenuMenuItem --------------------------------------------------------- | 42 // EmptyMenuMenuItem --------------------------------------------------------- |
| 42 | 43 |
| 43 // EmptyMenuMenuItem is used when a menu has no menu items. EmptyMenuMenuItem | 44 // EmptyMenuMenuItem is used when a menu has no menu items. EmptyMenuMenuItem |
| 44 // is itself a MenuItemView, but it uses a different ID so that it isn't | 45 // is itself a MenuItemView, but it uses a different ID so that it isn't |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 756 // only need the background when we want it to look different, as when we're | 757 // only need the background when we want it to look different, as when we're |
| 757 // selected. | 758 // selected. |
| 758 ui::NativeTheme* native_theme = GetNativeTheme(); | 759 ui::NativeTheme* native_theme = GetNativeTheme(); |
| 759 SkColor override_color; | 760 SkColor override_color; |
| 760 if (delegate && delegate->GetBackgroundColor(GetCommand(), | 761 if (delegate && delegate->GetBackgroundColor(GetCommand(), |
| 761 render_selection, | 762 render_selection, |
| 762 &override_color)) { | 763 &override_color)) { |
| 763 canvas->DrawColor(override_color); | 764 canvas->DrawColor(override_color); |
| 764 } else if (render_selection) { | 765 } else if (render_selection) { |
| 765 gfx::Rect item_bounds(0, 0, width(), height()); | 766 gfx::Rect item_bounds(0, 0, width(), height()); |
| 767 // Avoids painting over the menu border. | |
|
sky
2016/09/30 02:46:42
Doesn't MenuScrollViewContainer::Layout inset by t
Bret
2016/09/30 18:27:53
Ok... I didn't notice that layout had some weird i
| |
| 768 item_bounds.Inset(views::RoundRectPainter::kBorderWidth, 0); | |
| 766 AdjustBoundsForRTLUI(&item_bounds); | 769 AdjustBoundsForRTLUI(&item_bounds); |
| 767 | 770 |
| 768 native_theme->Paint(canvas->sk_canvas(), | 771 native_theme->Paint(canvas->sk_canvas(), |
| 769 ui::NativeTheme::kMenuItemBackground, | 772 ui::NativeTheme::kMenuItemBackground, |
| 770 ui::NativeTheme::kHovered, | 773 ui::NativeTheme::kHovered, |
| 771 item_bounds, | 774 item_bounds, |
| 772 ui::NativeTheme::ExtraParams()); | 775 ui::NativeTheme::ExtraParams()); |
| 773 } | 776 } |
| 774 | 777 |
| 775 const int icon_x = config.item_left_margin + left_icon_margin_; | 778 const int icon_x = config.item_left_margin + left_icon_margin_; |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1081 } else { | 1084 } else { |
| 1082 const Type& type = menu_item->GetType(); | 1085 const Type& type = menu_item->GetType(); |
| 1083 if (type == CHECKBOX || type == RADIO) | 1086 if (type == CHECKBOX || type == RADIO) |
| 1084 return true; | 1087 return true; |
| 1085 } | 1088 } |
| 1086 } | 1089 } |
| 1087 return false; | 1090 return false; |
| 1088 } | 1091 } |
| 1089 | 1092 |
| 1090 } // namespace views | 1093 } // namespace views |
| OLD | NEW |