| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "gfx/canvas.h" | 8 #include "gfx/canvas.h" |
| 9 #include "gfx/favicon_size.h" | 9 #include "gfx/favicon_size.h" |
| 10 #include "grit/app_resources.h" | 10 #include "grit/app_resources.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Render the foreground. | 67 // Render the foreground. |
| 68 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
| 69 SkColor fg_color = | 69 SkColor fg_color = |
| 70 IsEnabled() ? SK_ColorBLACK : SkColorSetRGB(0x80, 0x80, 0x80); | 70 IsEnabled() ? SK_ColorBLACK : SkColorSetRGB(0x80, 0x80, 0x80); |
| 71 #else | 71 #else |
| 72 SkColor fg_color = | 72 SkColor fg_color = |
| 73 IsEnabled() ? TextButton::kEnabledColor : TextButton::kDisabledColor; | 73 IsEnabled() ? TextButton::kEnabledColor : TextButton::kDisabledColor; |
| 74 #endif | 74 #endif |
| 75 const gfx::Font& font = GetChildViewCount() > 0 ? | 75 const gfx::Font& font = MenuConfig::instance().font; |
| 76 MenuConfig::instance().font_with_controls : MenuConfig::instance().font; | |
| 77 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); | 76 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); |
| 78 int width = this->width() - item_right_margin_ - label_start_ - accel_width; | 77 int width = this->width() - item_right_margin_ - label_start_ - accel_width; |
| 79 gfx::Rect text_bounds(label_start_, top_margin + | 78 gfx::Rect text_bounds(label_start_, top_margin + |
| 80 (available_height - font.height()) / 2, width, | 79 (available_height - font.height()) / 2, width, |
| 81 font.height()); | 80 font.height()); |
| 82 text_bounds.set_x(MirroredLeftPointForRect(text_bounds)); | 81 text_bounds.set_x(MirroredLeftPointForRect(text_bounds)); |
| 83 canvas->DrawStringInt(GetTitle(), font, fg_color, | 82 canvas->DrawStringInt(GetTitle(), font, fg_color, |
| 84 text_bounds.x(), text_bounds.y(), text_bounds.width(), | 83 text_bounds.x(), text_bounds.y(), text_bounds.width(), |
| 85 text_bounds.height(), | 84 text_bounds.height(), |
| 86 GetRootMenuItem()->GetDrawStringFlags()); | 85 GetRootMenuItem()->GetDrawStringFlags()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 106 config.arrow_width) / 2, | 105 config.arrow_width) / 2, |
| 107 config.arrow_width, height()); | 106 config.arrow_width, height()); |
| 108 AdjustBoundsForRTLUI(&arrow_bounds); | 107 AdjustBoundsForRTLUI(&arrow_bounds); |
| 109 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 108 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 110 canvas->DrawBitmapInt(*rb.GetBitmapNamed(IDR_MENU_ARROW), | 109 canvas->DrawBitmapInt(*rb.GetBitmapNamed(IDR_MENU_ARROW), |
| 111 arrow_bounds.x(), arrow_bounds.y()); | 110 arrow_bounds.x(), arrow_bounds.y()); |
| 112 } | 111 } |
| 113 } | 112 } |
| 114 | 113 |
| 115 } // namespace views | 114 } // namespace views |
| OLD | NEW |