| 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 "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "grit/ui_strings.h" | 10 #include "grit/ui_strings.h" |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 GetTopMargin(), max_accel_width, available_height); | 679 GetTopMargin(), max_accel_width, available_height); |
| 680 accel_bounds.set_x(GetMirroredXForRect(accel_bounds)); | 680 accel_bounds.set_x(GetMirroredXForRect(accel_bounds)); |
| 681 int flags = GetRootMenuItem()->GetDrawStringFlags() | | 681 int flags = GetRootMenuItem()->GetDrawStringFlags() | |
| 682 gfx::Canvas::TEXT_VALIGN_MIDDLE; | 682 gfx::Canvas::TEXT_VALIGN_MIDDLE; |
| 683 flags &= ~(gfx::Canvas::TEXT_ALIGN_RIGHT | gfx::Canvas::TEXT_ALIGN_LEFT); | 683 flags &= ~(gfx::Canvas::TEXT_ALIGN_RIGHT | gfx::Canvas::TEXT_ALIGN_LEFT); |
| 684 if (base::i18n::IsRTL()) | 684 if (base::i18n::IsRTL()) |
| 685 flags |= gfx::Canvas::TEXT_ALIGN_LEFT; | 685 flags |= gfx::Canvas::TEXT_ALIGN_LEFT; |
| 686 else | 686 else |
| 687 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; | 687 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; |
| 688 canvas->DrawStringInt( | 688 canvas->DrawStringInt( |
| 689 accel_text, font, gfx::NativeTheme::instance()->GetSystemColor( | 689 accel_text, font, ui::NativeTheme::instance()->GetSystemColor( |
| 690 gfx::NativeTheme::kColorId_TextButtonDisabledColor), | 690 ui::NativeTheme::kColorId_TextButtonDisabledColor), |
| 691 accel_bounds.x(), accel_bounds.y(), accel_bounds.width(), | 691 accel_bounds.x(), accel_bounds.y(), accel_bounds.width(), |
| 692 accel_bounds.height(), flags); | 692 accel_bounds.height(), flags); |
| 693 } | 693 } |
| 694 | 694 |
| 695 void MenuItemView::DestroyAllMenuHosts() { | 695 void MenuItemView::DestroyAllMenuHosts() { |
| 696 if (!HasSubmenu()) | 696 if (!HasSubmenu()) |
| 697 return; | 697 return; |
| 698 | 698 |
| 699 submenu_->Close(); | 699 submenu_->Close(); |
| 700 for (int i = 0, item_count = submenu_->GetMenuItemCount(); i < item_count; | 700 for (int i = 0, item_count = submenu_->GetMenuItemCount(); i < item_count; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 } | 776 } |
| 777 | 777 |
| 778 bool MenuItemView::IsContainer() const { | 778 bool MenuItemView::IsContainer() const { |
| 779 // Let the first child take over |this| when we only have one child and no | 779 // Let the first child take over |this| when we only have one child and no |
| 780 // title. Note that what child_count() returns is the number of children, | 780 // title. Note that what child_count() returns is the number of children, |
| 781 // not the number of menu items. | 781 // not the number of menu items. |
| 782 return child_count() == 1 && title_.empty(); | 782 return child_count() == 1 && title_.empty(); |
| 783 } | 783 } |
| 784 | 784 |
| 785 } // namespace views | 785 } // namespace views |
| OLD | NEW |