| 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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 int flags = GetDrawStringFlags(); | 838 int flags = GetDrawStringFlags(); |
| 839 if (mode == PB_FOR_DRAG) | 839 if (mode == PB_FOR_DRAG) |
| 840 flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING; | 840 flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING; |
| 841 canvas->DrawStringRectWithFlags(title(), font_list, fg_color, text_bounds, | 841 canvas->DrawStringRectWithFlags(title(), font_list, fg_color, text_bounds, |
| 842 flags); | 842 flags); |
| 843 if (!subtitle_.empty()) { | 843 if (!subtitle_.empty()) { |
| 844 canvas->DrawStringRectWithFlags( | 844 canvas->DrawStringRectWithFlags( |
| 845 subtitle_, | 845 subtitle_, |
| 846 font_list, | 846 font_list, |
| 847 GetNativeTheme()->GetSystemColor( | 847 GetNativeTheme()->GetSystemColor( |
| 848 ui::NativeTheme::kColorId_ButtonDisabledColor), | 848 ui::NativeTheme::kColorId_MenuItemSubtitleColor), |
| 849 text_bounds + gfx::Vector2d(0, font_list.GetHeight()), | 849 text_bounds + gfx::Vector2d(0, font_list.GetHeight()), |
| 850 flags); | 850 flags); |
| 851 } | 851 } |
| 852 | 852 |
| 853 PaintMinorText(canvas, render_selection); | 853 PaintMinorText(canvas, render_selection); |
| 854 | 854 |
| 855 // Render the submenu indicator (arrow). | 855 // Render the submenu indicator (arrow). |
| 856 if (HasSubmenu()) { | 856 if (HasSubmenu()) { |
| 857 gfx::ImageSkia arrow = GetSubmenuArrowImage(icon_color); | 857 gfx::ImageSkia arrow = GetSubmenuArrowImage(icon_color); |
| 858 gfx::Rect arrow_bounds(this->width() - config.arrow_width - | 858 gfx::Rect arrow_bounds(this->width() - config.arrow_width - |
| (...skipping 25 matching lines...) Expand all Loading... |
| 884 flags &= ~(gfx::Canvas::TEXT_ALIGN_RIGHT | gfx::Canvas::TEXT_ALIGN_LEFT); | 884 flags &= ~(gfx::Canvas::TEXT_ALIGN_RIGHT | gfx::Canvas::TEXT_ALIGN_LEFT); |
| 885 if (base::i18n::IsRTL()) | 885 if (base::i18n::IsRTL()) |
| 886 flags |= gfx::Canvas::TEXT_ALIGN_LEFT; | 886 flags |= gfx::Canvas::TEXT_ALIGN_LEFT; |
| 887 else | 887 else |
| 888 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; | 888 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; |
| 889 canvas->DrawStringRectWithFlags( | 889 canvas->DrawStringRectWithFlags( |
| 890 minor_text, | 890 minor_text, |
| 891 GetFontList(), | 891 GetFontList(), |
| 892 GetNativeTheme()->GetSystemColor(render_selection ? | 892 GetNativeTheme()->GetSystemColor(render_selection ? |
| 893 ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor : | 893 ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor : |
| 894 ui::NativeTheme::kColorId_ButtonDisabledColor), | 894 ui::NativeTheme::kColorId_MenuItemSubtitleColor), |
| 895 accel_bounds, | 895 accel_bounds, |
| 896 flags); | 896 flags); |
| 897 } | 897 } |
| 898 | 898 |
| 899 void MenuItemView::DestroyAllMenuHosts() { | 899 void MenuItemView::DestroyAllMenuHosts() { |
| 900 if (!HasSubmenu()) | 900 if (!HasSubmenu()) |
| 901 return; | 901 return; |
| 902 | 902 |
| 903 submenu_->Close(); | 903 submenu_->Close(); |
| 904 for (int i = 0, item_count = submenu_->GetMenuItemCount(); i < item_count; | 904 for (int i = 0, item_count = submenu_->GetMenuItemCount(); i < item_count; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 } else { | 1078 } else { |
| 1079 const Type& type = menu_item->GetType(); | 1079 const Type& type = menu_item->GetType(); |
| 1080 if (type == CHECKBOX || type == RADIO) | 1080 if (type == CHECKBOX || type == RADIO) |
| 1081 return true; | 1081 return true; |
| 1082 } | 1082 } |
| 1083 } | 1083 } |
| 1084 return false; | 1084 return false; |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 } // namespace views | 1087 } // namespace views |
| OLD | NEW |