OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
9 #include "third_party/skia/include/effects/SkGradientShader.h" | 9 #include "third_party/skia/include/effects/SkGradientShader.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 top_margin + | 57 top_margin + |
58 (height() - top_margin - bottom_margin - | 58 (height() - top_margin - bottom_margin - |
59 image->height()) / 2, | 59 image->height()) / 2, |
60 image->width(), | 60 image->width(), |
61 image->height()); | 61 image->height()); |
62 AdjustBoundsForRTLUI(&radio_bounds); | 62 AdjustBoundsForRTLUI(&radio_bounds); |
63 canvas->DrawBitmapInt(*image, radio_bounds.x(), radio_bounds.y()); | 63 canvas->DrawBitmapInt(*image, radio_bounds.x(), radio_bounds.y()); |
64 } | 64 } |
65 | 65 |
66 // Render the foreground. | 66 // Render the foreground. |
67 SkColor fg_color = | 67 SkColor fg_color = enabled() ? TextButton::kEnabledColor |
68 IsEnabled() ? TextButton::kEnabledColor : TextButton::kDisabledColor; | 68 : TextButton::kDisabledColor; |
69 const gfx::Font& font = GetFont(); | 69 const gfx::Font& font = GetFont(); |
70 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); | 70 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); |
71 int width = this->width() - item_right_margin_ - label_start_ - accel_width; | 71 int width = this->width() - item_right_margin_ - label_start_ - accel_width; |
72 gfx::Rect text_bounds(label_start_, top_margin + | 72 gfx::Rect text_bounds(label_start_, top_margin + |
73 (available_height - font.GetHeight()) / 2, width, | 73 (available_height - font.GetHeight()) / 2, width, |
74 font.GetHeight()); | 74 font.GetHeight()); |
75 text_bounds.set_x(GetMirroredXForRect(text_bounds)); | 75 text_bounds.set_x(GetMirroredXForRect(text_bounds)); |
76 canvas->DrawStringInt(title(), font, fg_color, | 76 canvas->DrawStringInt(title(), font, fg_color, |
77 text_bounds.x(), text_bounds.y(), text_bounds.width(), | 77 text_bounds.x(), text_bounds.y(), text_bounds.width(), |
78 text_bounds.height(), | 78 text_bounds.height(), |
(...skipping 19 matching lines...) Expand all Loading... |
98 top_margin + (available_height - | 98 top_margin + (available_height - |
99 config.arrow_width) / 2, | 99 config.arrow_width) / 2, |
100 config.arrow_width, height()); | 100 config.arrow_width, height()); |
101 AdjustBoundsForRTLUI(&arrow_bounds); | 101 AdjustBoundsForRTLUI(&arrow_bounds); |
102 canvas->DrawBitmapInt(*GetSubmenuArrowImage(), | 102 canvas->DrawBitmapInt(*GetSubmenuArrowImage(), |
103 arrow_bounds.x(), arrow_bounds.y()); | 103 arrow_bounds.x(), arrow_bounds.y()); |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 } // namespace views | 107 } // namespace views |
OLD | NEW |