| 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 <uxtheme.h> | 7 #include <uxtheme.h> |
| 8 #include <Vssym32.h> | 8 #include <Vssym32.h> |
| 9 | 9 |
| 10 #include "grit/ui_strings.h" | 10 #include "grit/ui_strings.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Render the foreground. | 82 // Render the foreground. |
| 83 // Menu color is specific to Vista, fallback to classic colors if can't | 83 // Menu color is specific to Vista, fallback to classic colors if can't |
| 84 // get color. | 84 // get color. |
| 85 SkColor fg_color = ui::NativeThemeWin::instance()->GetThemeColorWithDefault( | 85 SkColor fg_color = ui::NativeThemeWin::instance()->GetThemeColorWithDefault( |
| 86 ui::NativeThemeWin::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, | 86 ui::NativeThemeWin::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, |
| 87 default_sys_color); | 87 default_sys_color); |
| 88 const gfx::Font& font = GetFont(); | 88 const gfx::Font& font = GetFont(); |
| 89 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); | 89 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); |
| 90 int width = this->width() - item_right_margin_ - label_start_ - accel_width; | 90 int width = this->width() - item_right_margin_ - label_start_ - accel_width; |
| 91 int height = this->height() - GetTopMargin() - GetBottomMargin(); | 91 int height = this->height() - GetTopMargin() - GetBottomMargin(); |
| 92 int flags = gfx::Canvas::TEXT_VALIGN_MIDDLE | GetDrawStringFlags(); | 92 int flags = GetDrawStringFlags(); |
| 93 gfx::Rect text_bounds(label_start_, top_margin, width, height); | 93 gfx::Rect text_bounds(label_start_, top_margin, width, height); |
| 94 text_bounds.set_x(GetMirroredXForRect(text_bounds)); | 94 text_bounds.set_x(GetMirroredXForRect(text_bounds)); |
| 95 if (mode == PB_FOR_DRAG) { | 95 if (mode == PB_FOR_DRAG) { |
| 96 // With different themes, it's difficult to tell what the correct | 96 // With different themes, it's difficult to tell what the correct |
| 97 // foreground and background colors are for the text to draw the correct | 97 // foreground and background colors are for the text to draw the correct |
| 98 // halo. Instead, just draw black on white, which will look good in most | 98 // halo. Instead, just draw black on white, which will look good in most |
| 99 // cases. | 99 // cases. |
| 100 canvas->DrawStringWithHalo(title(), font, 0x00000000, 0xFFFFFFFF, | 100 canvas->DrawStringWithHalo(title(), font, 0x00000000, 0xFFFFFFFF, |
| 101 text_bounds.x(), text_bounds.y(), text_bounds.width(), | 101 text_bounds.x(), text_bounds.y(), text_bounds.width(), |
| 102 text_bounds.height(), flags); | 102 text_bounds.height(), flags); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 NativeTheme::kMenuCheckBackground, state, bg_bounds, extra); | 155 NativeTheme::kMenuCheckBackground, state, bg_bounds, extra); |
| 156 | 156 |
| 157 // And the check. | 157 // And the check. |
| 158 gfx::Rect icon_bounds(icon_x / 2, icon_y, icon_width, icon_height); | 158 gfx::Rect icon_bounds(icon_x / 2, icon_y, icon_width, icon_height); |
| 159 AdjustBoundsForRTLUI(&icon_bounds); | 159 AdjustBoundsForRTLUI(&icon_bounds); |
| 160 GetNativeTheme()->Paint(canvas->sk_canvas(), | 160 GetNativeTheme()->Paint(canvas->sk_canvas(), |
| 161 NativeTheme::kMenuCheck, state, bg_bounds, extra); | 161 NativeTheme::kMenuCheck, state, bg_bounds, extra); |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace views | 164 } // namespace views |
| OLD | NEW |