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/menu/menu_item_view.h" | 5 #include "views/controls/menu/menu_item_view.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/menus/menu_model.h" | 8 #include "app/menus/menu_model.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "gfx/canvas.h" | 10 #include "gfx/canvas.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 GetTopMargin(), max_accel_width, available_height); | 606 GetTopMargin(), max_accel_width, available_height); |
607 accel_bounds.set_x(MirroredLeftPointForRect(accel_bounds)); | 607 accel_bounds.set_x(MirroredLeftPointForRect(accel_bounds)); |
608 int flags = GetRootMenuItem()->GetDrawStringFlags() | | 608 int flags = GetRootMenuItem()->GetDrawStringFlags() | |
609 gfx::Canvas::TEXT_VALIGN_MIDDLE; | 609 gfx::Canvas::TEXT_VALIGN_MIDDLE; |
610 flags &= ~(gfx::Canvas::TEXT_ALIGN_RIGHT | gfx::Canvas::TEXT_ALIGN_LEFT); | 610 flags &= ~(gfx::Canvas::TEXT_ALIGN_RIGHT | gfx::Canvas::TEXT_ALIGN_LEFT); |
611 if (base::i18n::IsRTL()) | 611 if (base::i18n::IsRTL()) |
612 flags |= gfx::Canvas::TEXT_ALIGN_LEFT; | 612 flags |= gfx::Canvas::TEXT_ALIGN_LEFT; |
613 else | 613 else |
614 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; | 614 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; |
615 canvas->DrawStringInt( | 615 canvas->DrawStringInt( |
616 UTF16ToWideHack(accel_text), font, TextButton::kDisabledColor, | 616 accel_text, font, TextButton::kDisabledColor, |
617 accel_bounds.x(), accel_bounds.y(), accel_bounds.width(), | 617 accel_bounds.x(), accel_bounds.y(), accel_bounds.width(), |
618 accel_bounds.height(), flags); | 618 accel_bounds.height(), flags); |
619 } | 619 } |
620 | 620 |
621 void MenuItemView::DestroyAllMenuHosts() { | 621 void MenuItemView::DestroyAllMenuHosts() { |
622 if (!HasSubmenu()) | 622 if (!HasSubmenu()) |
623 return; | 623 return; |
624 | 624 |
625 submenu_->Close(); | 625 submenu_->Close(); |
626 for (int i = 0, item_count = submenu_->GetMenuItemCount(); i < item_count; | 626 for (int i = 0, item_count = submenu_->GetMenuItemCount(); i < item_count; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 } | 658 } |
659 | 659 |
660 string16 MenuItemView::GetAcceleratorText() { | 660 string16 MenuItemView::GetAcceleratorText() { |
661 Accelerator accelerator; | 661 Accelerator accelerator; |
662 return (GetDelegate() && | 662 return (GetDelegate() && |
663 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? | 663 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? |
664 accelerator.GetShortcutText() : string16(); | 664 accelerator.GetShortcutText() : string16(); |
665 } | 665 } |
666 | 666 |
667 } // namespace views | 667 } // namespace views |
OLD | NEW |